软硬件环境
问题描述
1130 - Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server
这个错误是由于客户端没有连接远程服务器的权限
解决方法
第一步,来到mysql
服务器,编辑配置文件/etc/mysql/mysql.conf.d/mysqld.cnf
,将原来的
bind-address = 127.0.0.1
修改成
bind-address = 0.0.0.0
第二步,在终端中使用mysql
的超级管理员登录mysql
,这里以root
为例,实际情况自行修改
mysql -uroot -p
use mysql;
select host,user from user;
update user set host='%' where user='root';
flush privileges;
修改完后,重启mysql
服务
sudo /etc/init.d/mysql restart