远程mysql报错GHost ‘xxx‘ is not allowed to connect to this MySQL serverConnection closed by foreign host

Posted 二木成林

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了远程mysql报错GHost ‘xxx‘ is not allowed to connect to this MySQL serverConnection closed by foreign host相关的知识,希望对你有一定的参考价值。

异常

在另一个主机执行telnet命令远程访问mysql的3306端口报错:GHost '192.168.88.132' is not allowed to connect to this MySQL serverConnection closed by foreign host.

原因

mysql数据库不允许远程主机访问当前数据库。

解决

修改user表的host项。在192.168.88.133号主机中登录mysql,然后执行如下命令:

# 选择mysql数据库
use mysql;
# 修改host项
update user set host='%' where user='root';
# 查看修改后的项
select host,user from user;

退出数据库后,执行service mysqld restart命令重启数据库服务。

然后再在另一台主机远程访问就能成功访问到192.168.88.133主机的端口号了

以上是关于远程mysql报错GHost ‘xxx‘ is not allowed to connect to this MySQL serverConnection closed by foreign host的主要内容,如果未能解决你的问题,请参考以下文章

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

解决MySql报错:1130 - Host 'xxx' is not allowed to connect to this MySQL server的方法

解决centos7.4 安装LAMP环境后报错:1130- Host xxx is not allowed to……

1130 - Host XXX is not allowed to connect to this MySQL server。

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远程连接报错