mysqli_connect
<?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'); }?>
[mysqld]# The default authentication plugin to be used when connecting to the serverdefault_authentication_plugin=caching_sha2_password #default_authentication_plugin=mysql_native_password
caching_sha2_password
错误:mysqli_CONNECT():服务器请求客户端[缓存_sha2_密码]中未知的身份验证方法。
mysql_native_password
caching_sha2_password
白衣染霜花