用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理

这个问题是因为在数据库服务器中的mysql数据库中的user的表中没有权限(也可以说没有用户),下面将记录我遇到问题的过程及解决的方法。

用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理_第1张图片

遇到这个问题首先到mysql所在的服务器上用连接进行处理

我这里是用的docker容器:

 连接服务器:

docker exec -it 934e3c005153 /bin/bash

 mysql -uroot -proot

用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理_第2张图片

查看当前所有数据库:show databases;

用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理_第3张图片

进入mysql数据库:use mysql;

用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理_第4张图片

查看mysql数据库中所有的表:show tables;

用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理_第5张图片

查看user表中的数据:select user,host from user;

用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理_第6张图片

修改user表中的update user set host='%' where user='root';

最后刷新一下:flush privileges;

用navicat连接数据库报错:1130-host ... is not allowed to connect to this MySql server如何处理_第7张图片

你可能感兴趣的:(数据库)