默认情况下Mysql只允许本地登录,所以需要修改配置文件将地址绑定给注释掉:
vim /etc/mysql/my.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1 <---注释掉这一行就可以远程登录了
--修改访问权限
GRANT ALL PRIVILEGES ON *.* TO 'Mysql用户名'@'远程IP地址' IDENTIFIED BY 'Mysql用户名密码' WITH GRANT OPTION;
![](https://img-my.csdn.net/uploads/201211/15/1352962934_5936.jpg)
![](https://img-my.csdn.net/uploads/201211/15/1352963013_6521.jpg)