Navicat连接错误1130:is not allowed to connect to this mysql server

使用Navicat连接远程数据库的时候,发生连接错误is not allowed to connect to this mysql server。

后来查了各种资料,就是连接的用户没有远程访问权限
处理办法,给连接的用户加上远程访问权限。
以root用户为例。

1.先登录到远程仓库的mysql。

mysql -u root -p
在这里插入图片描述

2.进入mysql数据库。

use mysql;
在这里插入图片描述

3.查看user表的host字段

select host from user where user='root';
在这里插入图片描述
这些是允许访问数据库的地址。我们可以追加一条也可以直接将localhost改成%允许所有地址使用这个
用户访问。

4.更改host字段允许远程访问

update user set host='%' where user = 'root' and host='localhost';
在这里插入图片描述
然后再查看一下这个字段的字
select host from user where user='root';
在这里插入图片描述
如图所示说明修改成功。最后使用命令更新设定即可。

5.更新设定

flush privileges;
在这里插入图片描述
这样重新使用navicat重新连接,就可以连接成功了。
对你有帮助吗?点个赞吧~

猜你喜欢

转载自blog.csdn.net/qq_42068856/article/details/109293298