I just started using docker, laradock and laravel, after setting up the entire environment I tried to login on my phpmyadmin and I couldn't sign in.
I looked pretty much everywhere and couldn't find a way to fix it so you guys are my last hope lol.
Docker version 17.12.0-ce, build c97c6d6 Here's my docker ps
My project's .env
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
And here are the errors I am getting from phpmyadmin (localhost:8080)
#2054 - The server requested authentication method unknown to the client
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
The easiest solution is to revert back to an earlier version of MySQL. It's probably a good idea anyway since 8.0 is a "developer's release". Unfortunately Laradock currently has a bug that installs 8.0 no matter what you set in the .env file. I've submitted a PR on Laradock to fix this particular issue.
This is caused by an update to libmysqlclient
since MySQL version 8.0.4 which has changed the default authentication method to a more secure sha256_password
.
As soon as Laravel and other software packages such as PhpMyAdmin are updated to support this new and more secure authentication method this problem wil resolve itself.
If you CANNOT delete and rebuild your existing mysql data volume, simply:
docker-compose exec mysql mysql -uroot -proot
)ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
If you CAN recreate your mysql data volume:
my.conf
file. Under [mysqld]
add the following configuration option default_authentication_plugin=mysql_native_password
rm -rf ~./laradock/data/mysql
docker-compose -d --build mysql phpmyadmin
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.