在docker上新安装的mysql的容器,使用win10的workbench可以连接访问,但是使用Navicat连接就会报错。
在navicat11版本下报错1251Client does not support authentication protocol requested by server
在navicat12版本下报错2059 Authentication plugin 'caching_sha2_password' cannot
我记得在以前使用mysql5.7版本的容器时,是没有出现这样的问题。所以先查询了下当前mysql的版本。
经过一番百度探索得知:
原因是docker mysql为最新的,更换了新的身份验证插件(caching_sha2_password), 原来的身份验证插件为(mysql_native_password),即版本不兼容问题
docker exec -it mysql bash;
mysql -uroot -p;
输入密码
alter user 'root'@'localhost' identified by 'yourpassword' password expire never;
yourpassword
为你自己mysql的密码
mysql_native_password
设置新密码ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newyourpassword';
newyourpassword
为你自己mysql的新密码
flush privileges;
百度到的问题解决方案,到这里就可以解决问题,但是我的问题还是没有解决,继续…
还是在mysql的命令行模式下继续解决问题,(如果不在,进入mysql容器,重新登录)
use mysql;
select user,host,plugin,authentication_string from user;
alter user 'root'@'%' identified with mysql_native_password by 'yourPassword';
flush privileges;
select user,host,plugin,authentication_string from user;
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- shangjiatang.cn 版权所有 湘ICP备2022005869号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务