PHP Warning: PDO::__construct(): Server sent charset (255) unknown to the client

PHP连接MySQL 8.0连接不上,查看apache日志报错:PHP Warning: PDO::__construct(): Server sent charset (255) unknown to the client,出现这个的原因是MySQL 8.0 字符集改成了默认: utf8mb4,修改mysql 8.0默认字符集为utf8即可

[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
character-set-server = utf8
collation-server = utf8_general_ci