Sometimes, we want to fix PHP mysqli_connect: authentication method unknown to the client [caching_sha2_password] with PHP and MySQL.
In this article, we’ll look at how to fix PHP mysqli_connect: authentication method unknown to the client [caching_sha2_password] with PHP and MySQL.
How to fix PHP mysqli_connect: authentication method unknown to the client [caching_sha2_password] with PHP and MySQL?
To fix PHP mysqli_connect: authentication method unknown to the client [caching_sha2_password] with PHP and MySQL, we can set the user password.
For instance, we run
ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
to set the mysqlUsername
MySQL user’s password to mysqlUsernamePassword
.
And we set the authentication method of the user to using password.
Conclusion
To fix PHP mysqli_connect: authentication method unknown to the client [caching_sha2_password] with PHP and MySQL, we can set the user password.