phpMyAdmin报错Server sent charset (255) unknown和(HY000/2054)的解决方法

今天在win7上配置了php环境。apache,php,mysql都设置好了,在phpMyAdmin登录时,报错:
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers

这是因为在MySQL 8.0.11中,caching_sha2_password是默认的身份验证插件,而不是以往的mysql_native_password。所以和php不兼容。可以降级php,也可以修改MySQL的配置。

我决定修改MySQL的配置。可是我进入C:\Program Files\MySQL\MySQL Server 8.0,怎么也找不到配置文件(my.ini或者mysqld.cnf)。最后在隐藏文件夹ProgramData里找到了,完整路径是C:\ProgramData\MySQL\MySQL Server 8.0\my.ini打开my.ini做如下配置:


[mysqld]
port=3306
character-set-server=utf8
default_authentication_plugin=mysql_native_password

[mysql]
default-character-set=utf8

[client]
default-character-set=utf8


然后在cmd里输入net stop mysql80net start mysql80

再到phpMyAdmin登录就可以了。

Smilie Vote is loading.
✿ 阅读数:33,299  分类:文章

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code