使用PHP5.6连接MySQL 8报错如何解决

PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers
PHP错误:SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
ERROR 1396 (HY000): Operation ALTER USER failed for ‘root’@‘localhost’
MySQL无法启动:start request repeated too quickly for mysqld.service

PHP 7.2.8和PHP 7.1.20已经可以支持caching_sha2_password,直接连接MySQL 8
PHP5.6连接mysql8

[root@instance-vlgd660i ~]# mysql -u root -p
Enter password: 
mysql> use mysql;
mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| root             | %         |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'test123';
Query OK, 0 rows affected (0.09 sec)
mysql> FLUSH PRIVILEGES;
mysql> exit;

你可能感兴趣的:(Linux,mysql8,php7.1)