Reputation: 796
When i have upgraded my PHP and MySQL versión, this errors are generating
Warning: mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]
Warning: mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to the client in
I am using this versions :
Codeigniter : 3.1.9
PHP : 7.2.6
MySql : 8.0.11
Thanx...
Upvotes: 3
Views: 15857
Reputation: 116
A Possible solution is to change the authentication plugin of the default user of the mysql or the root user of mysql .
just log in to mysql console(terminal/phpmyadmin) as root user , and reset the password as
ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
i would change the passwords of all existing users this way just to be safe,
you can get the list of existing users and their fields via ,
use mysql ;
select * from user \G;
i setup the mysql this way since the start and have had no such errors .
reference : php mysqli_connect: authentication method unknown to the client [caching_sha2_password]
Upvotes: 3
Reputation: 51
One extra suggestion:
if the problem persists, try to run your IDE as Administrator.
I did all the steps I saw in several answers in StackOverflow, but it was only after I run PhpStorm as Admin that I could make a successful login.
Upvotes: -1
Reputation: 390
It's the version of MySql, after version 8.0 it doesn't support the caching_sha2_password plugin
However if changing it's version is not an option you can try adding this in your mysql configuration file and then restart the server
[mysqld]
default-authentication-plugin=mysql_native_password
Upvotes: 2