1.问题
报错信息
ERROR 1130: Host ‘x.x.x.x’ is not allowed to connect to this MySQL server
2.原因
MySql数据库服务不允许使用ip为 x.x.x.x 的主机访问,只允许使用 localhost
3.解决方法
使用localhost连接数据库修改mysql库下user表中的root用户连接权限为%
ps:%为任意用户均可使用root用户访问

没有navicat的话使用如下命令修改连接权限
# 进入mysql库
use mysql;
# 修改root用户链接权限为“任意用户”
update user set host = '%' where user ='root';
# 刷新
flush privileges;
# 查看修改结果【可跳过】
select 'host' from user where user='root';
本文详细阐述了遇到的错误'ERROR 1130: Host 'x.x.x.x' is not allowed to connect to this MySQL server',分析原因是数据库仅允许localhost访问。提供了解决方案,包括使用localhost连接并修改root用户连接权限为%。

被折叠的 条评论
为什么被折叠?



