解决Host 'xxx' is not allowed to connect to this MySQL server

问题描述: 本地主机连接到服务器上的mysql时报错:Host 'xxx' is not allowed to connect to this MySQL server;

服务器配置;windows server;

分析: 这是mysql的访问权限问题

解决办法:

1.进入服务器,运行cmd进入dos界面;

2.输入命令:mysql -u root -p 输入密码;

3.命令:use mysql;

4.命令:grant all privileges on *.* to root@"xxx.xxx.xxx.xxx" identified by "密码";

("xxx.xxx.xxx.xxx"表示允许连接的主机ip,如果允许所有主机,使用"%"。 密码是允许主机连接时使用的密码)

(例如:grant all privileges on *.* to root@"%" identified by "123";)

5.查看mysql允许的主机: 命令:select user,password,host from user;

 

 

本人系新手上路,文章可能显得臃肿,写下来记录自己的成长历程。

水平有限,欢迎并感谢纠错指正

posted on 2017-10-01 09:25  不上,道  阅读(5434)  评论(0编辑  收藏  举报

导航