mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in /usr/share/nginx/html/wordpress/wp-includes/wp-db.php on line 1612
原因是MySQL 8启用了新的认证方式,PhpMyAdmin连接不认识,所以需要恢复到默认的认证模式。
- 解决方案如下:
- 1、打开/etc/my.cnf
-
在[mysqld]区段下增加
default-authentication-plugin=mysql_native_password
- 2、通过MySQL重设密码
-
mysql -u root -p
-
mysql> ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Query OK, 0 rows affected (0.01 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
重启mysql之后就可以了