我正在使用 php mysqli_connect 登录 MySQL 数据库(全部在本地主机上)
这是 mysql.user 表:
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
在MySQL Server ini文件中使用caching_sha2_password,根本不可能用user1或user2登录;
错误:mysqli_connect():服务器请求客户端 [caching_sha2_password] 未知的身份验证方法...
在MySQL Server ini文件中使用mysql_native_password,可以用user1登录,但是用user2登录,同样的错误;
如何在 mySql 服务器上使用 caching_sha2_password 登录?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号