我正在使用 PHPmysqli_connect
用于登录 MySQL 数据库(全部在本地主机上)
<?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');
}
?>
this is the mysql.user table:
MySQL 服务器 ini 文件:
[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
在MySQL Server ini文件中,根本不可能用user1或user2登录;
错误:mysqli_connect():服务器请求客户端 [caching_sha2_password] 未知的身份验证方法...
with mysql_native_password
在MySQL Server ini文件中,可以用user1登录,但用user2登录,同样的错误;
我怎样才能使用登录caching_sha2_password
在mysql服务器上?