如何解决1130 - Host ‘172.17.0.1‘ is not allowed to connect to this MySQL server的问题

如何解决1130 - Host ‘172.17.0.1‘ is not allowed to connect to this MySQL server的问题

1、docker pull mysql 安装mysql

2、启动mysql容器:docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql

使用Navicat连接会报 1130 - Host 172.17.0.1 is not allowed to connect to this MySQL server

按下面步骤修改:

6、连接mysql数据库:docker exec -it mysql bash

7、连接服务器: mysql -u root -p

8、看当前所有数据库:show databases ; 空格加分号

9、进入mysql数据库:use mysql ;

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

11、查看user表中的数据:select Host, User from user ;

12、修改user表中的Host: update user set Host= % where User= root ;

13、最后刷新一下:flush privileges ;

Navicat连接成功

如何解决1130 - Host ‘172.17.0.1‘ is not allowed to connect to this MySQL server的问题