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

localhost改成%

进入mysql的BIN目录

具体分析

1、在本机登入mysql后,更改“mysql”数据库里的“user”表里的“host”项,从”localhost”改为’%’

#查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称)

#修改host值(以通配符%的内容增加主机/IP地址,当然也可以直接增加某个特定IP地址,如果执行update语句时出现ERROR 1062 (23000): Duplicate entry ‘%-root’ for key ‘PRIMARY’ 错误,需要select host from user where user = ‘root’;

#如果报如下错误

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode

执行命令

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

 

评论已关闭。