Page 1 of 1

php mysqli_connect: authentication method unknown to the client [caching_sha2_password]

Posted: Fri Mar 20, 2020 9:15 pm
by mister_v
Hi,

I get the following error whe I tried to connect with php to MySQL server.
mysqli::__construct(): The server requested authentication method unknown to the client

How can I fix this?
I use standard login function:
$dbconn=new mysqli('127.0.0.1','user','passwd','database');

Re: php mysqli_connect: authentication method unknown to the client [caching_sha2_password]

Posted: Fri Mar 20, 2020 9:23 pm
by chris
MYSQL has changed it type of password (since Mysql 8 ?)
Anyway the easiest solution, is execute the following SQL command on MYSQL

Code: Select all

ALTER USER 'mysqlUsername'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlUsernamePassword';
It should solve your problem.