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

Posted 不上,道

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决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 [email protected]"xxx.xxx.xxx.xxx" identified by "密码";

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

(例如:grant all privileges on *.* to [email protected]"%" identified by "123";)

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

 

 

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

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

以上是关于解决Host 'xxx' is not allowed to connect to this MySQL server的主要内容,如果未能解决你的问题,请参考以下文章