Solvedlaradock Mysql. The server requested authentication method unknown to the client [caching_sha2_password]
✔️Accepted Answer
alter user 'username'@'localhost' identified with mysql_native_password by 'password';
would fix it.
Other Answers:
Don't uninstall MySQL 8. Sign into mysql using a terminal program:
mysql -u root -p
my_password
alter user 'username'@'localhost' identified with mysql_native_password by 'password';
This does the trick.
If you want to use mysql 8 with native password (the old way) you can follow the following steps:
Add this to my.cnf in laradock\mysql\my.cnf under [mysqld]:
default-authentication-plugin=mysql_native_password
Clear the data-folder (will destroy your data), rebuild the mysql container and it should work.
added these lines in docker-compose.yml fixed my issue:
mysql:
image: mysql:8
command: ['--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci','--default-authentication-plugin=mysql_native_password']
alter user 'username'@'localhost' identified with mysql_native_password by 'password';
Bravoo. This is the solution
Info:
Issue:
New fresh laradock installation. All default settings. Driver is shared.
Except:
Can't connect to the mysql from phpMyAdmin.

#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
But I can connect to mysql inside mysql container with standard root/root credentials.
I tried to delete all containers and images. Several times downloaded laradock. Tried to reinstall Docker. No success.
Expected behavior:
Can connect to mysql with phpMyAdmin
Logs