ERROR 1130: Host xxx is not allowed to connect to this MySQL server

在使用MySQL-Front连接mysql的时候发生的这个错误

ERROR 1130: Host xxx is not allowed to connect to this MySQL server

更改 mysql 数据库里的 user表里的 host项
localhost改称%

mysql -u root -p

mysql>use mysql;

mysql>update user set host = '%'  where user ='root';

  经过实际测试,有些情况下执行这条语句会报下面的错误:

  ERROR 1062 (23000): Duplicate entry ‘%-root’ for key ‘PRIMARY’

  改成这样的就可以执行了

  update user set host=’%’ where user=’root’ and host=’localhost’;

mysql>flush privileges;

mysql>select 'host','user' from user where user='root';

现在就可以连接了! 

  权限

     GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' with grant option;

原文地址:https://www.cnblogs.com/gaohj/p/3223182.html