1:修改my.cnf配置文件
$sudo vim /etc/mysql/my.cnf
修改为:
bind-address = 0.0.0.0
2:进行授权操作
mysql> grant all privileges on *.* to 'root'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql>
---允许所有以root用户登陆的所有主机(%)进行链接访问,在这里没有设置密码;
也可以设置密码:
grant all privileges on *.* to 'root'@'%' identified by 'mypassword' with grant option;