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 ;   空格加分号

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

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

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

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

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

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

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

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

 Navicat连接成功

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

觉得上面的内容有用吗?快来点个赞吧!

点赞() 我要打赏

温馨提示 : 本站内容来自会员投稿以及互联网,所有源码及教程均为作者总结编辑,请大家在使用过程中提前做好备份,以免发生无法预知的错误,源码类教程请勿直接用于生产环境!

 可能感兴趣的文章