PHP调用通过mysqli调用MySQL 数据库之前,必须配置MySQL 数据库的my.ini文件。对于MySQL 8数据库,除了同其它数据类似的常规安装外,则可能还需要my.cnf文件中启用mysql_native_password,具体操作参考如下:
default_authentication_plugin=mysql_native_password
因为MySQL 8 默认使用 caching_sha2_password,若你未使用 caching_sha2_password 时,也会看到类似这样的错误:
The server requested authentication method unknown to the client [caching_sha2_password]。
浙公网安备 33010602011771号