1、登录数据库
mysql -u root -p
2、授权法
mysql> use mysql;Database changedmysql> grant all privileges on *.* to myuser@'%' identified by "mypassword";Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
如果是固定ip就这么写
grant all privileges on *.* to 'myuser'@'192.168.0.49'identified by 'mypassword';