Host XXX is not allowed to connect to this MySQL server

Posted qian-520

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Host XXX is not allowed to connect to this MySQL server相关的知识,希望对你有一定的参考价值。

前言:

在多数据库开发模式中 ,难免会用到mysql

在搭建数据库的时候 ,可能并没有设置用户可以远程访问 

如以下报错 

 

技术图片

这时候我们在数据库中执行以下命令

use mysq;

select host from user where user=‘root‘;

数据库中并没有远程访问标识

技术图片

将Host设置为通配符%

update user set host = ‘%‘ where user =‘root‘;

  技术图片

Host修改完成后记得执行flush privilegs使配置立即生效,或者直接重启服务

 

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

host 'XXX.XXX.XXX.XXX'is not allowed to connect to this MySQL server mysql远程连接报错

Host XXX is not allowed to connect to this MySQL server

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

Host 'XXX' is not allowed to connect to this MySQL server 解决方案

java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect

1130 - Host'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server解决Navicat连接MySQL报