虚拟机中docker安装mysql远程无法访问
问题:虚拟机中docker安装mysql远程无法访问
背景:
[ ~]# docker run -p 3306:3306 --name mysql01 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
navicat远程连接mysql的时候,会提示以下错误:
1251-Client does not support authentication protocol requested by server; consider upgrading MySQL client
解决:
1.在虚拟机中登录到mysql容器,然后进入mysql
[ ~]# docker exec -it mysql01 bash :/# mysql -uroot -p
mysql> select host,user,plugin,authentication_string from mysql.user;
备注:host为 % 表示不限制ip localhost表示本机使用 plugin非mysql_native_password 则需要修改密码
2.修改密码
mysql> alter user ‘root‘@‘%‘ identified with mysql_native_password by ‘123456‘; Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec)
连接成功
相关推荐
VFCSDN 2020-10-14
星愿心愿 2020-11-24
ruancw 2020-11-10
somyjun 2020-09-29
longjing 2020-09-18
KINGJENSEN 2020-09-14
85251846 2020-09-14
周公周金桥 2020-09-06
lxttiger 2020-08-18
ARMOTO机器人 2020-08-18
atb 2020-08-17
SeetyST 2020-08-13
85206633 2020-08-15
yunna0 2020-08-15
young依然 2020-08-06
成长路上 2020-07-29
xiaogoua 2020-07-29
zhangsyi 2020-07-28