外部无法连接docker下mysql


docker安装mysql后,本地navicat连接报错client does not support authentication

解决办法:
1. docker ps -a 查找到容器id
2. docker exec -it id /bin/bash 进入mysql容器 
3.mysql -u root -p root登陆mysql

4.alter user 'root'@'%' identified with mysql_native_password by '123456';

可能遇到问题:

Access denied for user 'root'@'localhost' (using password: YES)

解决办法:

update user set authentication_string = 'root' where user = 'root' and host = '%';
update user set authentication_string = 'root' where user = 'root' and host = 'localhost';

或者重新创建一个容器


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM