I can not connect to the newer version of mysql image on duckerhub remotely.
I am using docker on archlinux. after running the docker and mysql image, i can connect to the docker instance and get the shell by sudo docker exec -it mysql bash & i can connect by mysql command with root user, but when it comes to mysqlWorkbench or my local machine terminal i get this error message ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory.
sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ef63f4caae4b mysql "docker-entrypoint.s…" 2 days ago Up About an hour 0.0.0.0:3307->3306/tcp mysql
im trying to connect it by port 3307
Got same issue when logging in through phpmyadmin:
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
I have the same problem (and error) with MySql Workbench. And funny because it worked fine like 2-3 weeks ago.
Have you guys pulled a recent version of mysql:latest within the past week or so? I believe the latest tag got moved up to the 8.x version of the MySQL image recently. A lot of the guys at our office had this issue popup because of it. We haven't gotten the 8.x version to work but have simply just adjusted our containers to specify the 5.7 version of the image.
I've changed to 5.7 and it's ok now. I haven't been paying attention which version is latest. Thanks!
@swickham78 Thanks for mentioning it, I forgot to mentation that I am using latest one which is 8.x; ; I do know the downgrading will solve the probelm, but I am more curious to know the issue, is it a Bug or I missed any step on the installation?
@mani-zaeim The cause is that MySQL 8.0 has changed the default authentication plugin from mysql_native_password to caching_sha2_password, and older clients may not support the new plugin, meaning they can't log in to users created with it.
A workaround you can use is to configure your 8.0 server with --default-authentication-plugin=mysql_native_password
@ltangvald Thanks for the solution and explination.
See also https://github.com/docker-library/mysql/issues/409.
Closing since this is resolved. :+1:
the problem is with the latest version of mysql image.
Generally never trust the "latest" version of a docker image, you will probably encounter many problems. It would always be better to pull an image with a specific version (5.7 for example) this will help you to avoid to much problems.
thanks
When will workbench support this new plugin?
(https://stackoverflow.com/questions/51530768/mysql-8-0-phpmyadmin-docker-caching-sha2-password-error)[https://stackoverflow.com/questions/51530768/mysql-8-0-phpmyadmin-docker-caching-sha2-password-error]
docker exec -it CONTAINERID bash and execute mysql command
ALTER USER root IDENTIFIED WITH mysql_native_password BY 'password';
if you are facing "caching_sha2_password" error during connectivity of your mysql database using python ,
go through this
https://www.youtube.com/watch?v=YNq-EuQEJos
Most helpful comment
@mani-zaeim The cause is that MySQL 8.0 has changed the default authentication plugin from mysql_native_password to caching_sha2_password, and older clients may not support the new plugin, meaning they can't log in to users created with it.
A workaround you can use is to configure your 8.0 server with --default-authentication-plugin=mysql_native_password