Mysql远程连接 Host * is not allowed to connect to this MySQL server

mysql -u root -p

mysql>use mysql;

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

mysql>flush privileges;

#修改host值(以通配符%的内容增加主机/IP地址,当然也可以直接增加某个特定IP地址

如果执行update语句时出现ERROR 1062 (23000): Duplicate entry ‘%-root’ for key ‘PRIMARY’ 错误

需要select host from user where user = ‘root’;

查看一下host是否已经有了%这个值,如果有了直接执行下面的flush privileges;

quit