If the authentication plugin type is not changed already it will throw an error message like “The server requested authentication method unknown to the client”. Solution : In order to fix this issue, you need to change the MySQL authentication plugin type. For this, you have to log in to the MySQL prompt first.
The mysql_native_password authentication plugin is the default authentication plugin that will be used for an account created when no authentication plugin is explicitly mentioned and old_passwords=0 is set.
I solve this by SQL command:
ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
which is referenced by https://dev.mysql.com/doc/refman/8.0/en/alter-user.html
if you are creating new user
CREATE USER 'jeffrey'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
which is referenced by https://dev.mysql.com/doc/refman/8.0/en/create-user.html
this works for me
As of PHP 7.4, this is no longer an issue. Support for caching_sha2
authentication method has been added to mysqlnd.
Currently, PHP mysqli extension do not support new caching_sha2 authentication feature. You have to wait until they release an update.
Check related post from MySQL developers: https://mysqlserverteam.com/upgrading-to-mysql-8-0-default-authentication-plugin-considerations/
They didn't mention PDO, maybe you should try to connect with PDO.
ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
Remove quotes (') after ALTER USER
and keep quote (') after mysql_native_password BY
It is working for me also.
If you're on Windows and it's not possible to use caching_sha2_password
at all, you can do the following:
The Installer will make all the configuration changes needed for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With