在安装Mysql8.0之后,需要跟我们原有的PHP进行协同工作,然而原先与Mysql5.1能够很好协同的代码,突然报错,看来需要做一些额外的工作。报错:PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers根据网上资料显示,是由于Mysql8.0将默认的字符集改为了utfmb4,因此和客户端(不仅仅是PHP)的通信无法识别,我们需要更改my.cnf来指定字符集。[client]default-character-set=utf8[mysql]default-character-set=utf8[mysqld]collation-server = utf8_unicode_cicharacter-set-server = utf8报错:PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]根据网上资料显示,是由于用户身份认证的加密方式不兼容导致的,mysql8.0中默认方式为caching_sha2_password,引起老版本兼容性问题,老版本加密方式为mysql_native_password。新建用老版加密方式初始化密码的用户即可:CREATE USER username@localhost identified with mysql_native_password by ‘password’;报错:Access denied for user ‘root’@’localhost’ (using password: YES)mysql> GRANT ALL PRIVILEGES ON . TO ‘oss’@’%’;ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)在我给其他用户加权限的时候,报错无权限,原因是我一不小心删掉了root身份的用户,虽然网上有很多的文档解决这个问题,但是我重建后的root用户虽然拥有Grant_priv: Y但依然无法成功分配权限,我很头疼。解决方法:重装,参考文章安装Mysql8.0。总结mysql8.0有什么新的特性我没有详细查看文档,但是兼容性先让我吃了一顿苦头,还好在解决完这3个问题后,我的PHP程序成功跑了起来,下面我要去升级PHP5.1到PHP7了。参考资料PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers:https://stackoverflow.com/que…PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]:https://stackoverflow.com/que…安装Mysql8.0:https://segmentfault.com/a/11…