I am using php mysqli_connect for login to a MySQL database (all on localhost)
<?php
//DEFINE ('DB_USER', 'user2');
//DEFINE ('DB_PASSWORD', 'pass2');
DEFINE ('DB_USER', 'user1');
DEFINE ('DB_PASSWORD', 'pass1');
DEFINE ('DB_HOST', '127.0.0.1');
DEFINE ('DB_NAME', 'dbname');
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if(!$dbc){
die('error connecting to database');
}
?>
MySQL Server ini File:
[mysqld]
# The default authentication plugin to be used when connecting to the server
default_authentication_plugin=caching_sha2_password
#default_authentication_plugin=mysql_native_password
with caching_sha2_password in the MySQL Server ini file, it's not possible at all to login with user1 or user2;
error: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in...
with mysql_native_password in the MySQL Server ini file, it's possible to login with user1, but with user2, same error;
How can I login using caching_sha2_password on the mySql Server?