Linux下MySQL SQLSTATE[HY000] [1130] Host '115.29.104.101' is not allowed to connect to this MySQL server

1.sudo gedit /etc/mysql.my.cnf

找到bind-address =127.0.0.1

修改为bind-address =0.0.0.0

2.sudo /etc/init.d/ mysql restart

在这种情况下如果再尝试远程连接,则会报出ERROR 1130 (HY000): Host '211.87..'is not allowed to connect to this MySQL server提示信息,不能远程连接数据库。

在MySQL host上按如下命令操作

mysql -u root -ppassword //进入mysql控制台

mysql>use mysql;

mysql>update user set host = '%' where user = 'root'; //这个命令执行错误时可略过

mysql>flush privileges;

mysql>select host, user from user; //检查‘%’ 是否插入到数据库中

mysql>quit

你可能感兴趣的:(Linux下MySQL SQLSTATE[HY000] [1130] Host '115.29.104.101' is not allowed to connect to this MySQL server)