出现is not allowed to connect to this mysql server

Posted 最小的帆也能远航

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了出现is not allowed to connect to this mysql server相关的知识,希望对你有一定的参考价值。

腾讯云上的docker安装的mysql,防火墙端口开放了,发现用本地电脑的navicat链接不上。通过了解知道了原因,在此写了一篇,省的以后自己在碰到。

错误如图。

进入自己启动的容器

sudo docker exec -it mysql /bin/bash

 

  mysql -u root -p   登录到mysql中

use mysql; 

select host from user where user='root';

被修改的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入MySQL后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%" 

刷新配置。 

flush privileges; 

 

最后如图。连接成功。 

 

以上是关于出现is not allowed to connect to this mysql server的主要内容,如果未能解决你的问题,请参考以下文章

出现is not allowed to connect to this mysql server

出现is not allowed to connect to this mysql server

出现is not allowed to connect to this mysql server

mysql 出现Host 'localhost' is not allowed to connect to this MySQL server 错误。

Host 'XXX' is not allowed to connect to this MySQL server 解决方案

ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL