MySQL数据库连接报错1130 - Host 'xxx' is not allowed to connect to this MySQL server

本文解决MySQL数据库连接报错1130 - Host 'xxx' is not allowed to connect to this MySQL server。

现象描述

MySQL数据库,使用Navicat、root用户连接报错:

原因分析

这个报错原因是权限问题,需要修改连接权限。

进入mysql数据库,查看user表中的信息进行验证:

可以看到root用户只允许localhost进行登录,所以解决办法就是要对这个表进行修改,取消localhost的限制。

解决办法:

取消user表中root用户localhost连接的限制。

允许任何ip连接:update user set host = '%' where user ='root';

刷新权限:flush privileges;

再次尝试连接,连接成功。

 

2024-01-29 09:58:49【出处】:https://www.cnblogs.com/sgh1023/p/14946270.html

=======================================================================================

posted on 2024-01-29 09:59  jack_Meng  阅读(54)  评论(0编辑  收藏  举报

导航