外部無法連接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