【PhpMyAdmin】mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]



    打开PhpMyAdmin连MySQL 8,提示报错

    mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]

    mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client

    原因是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)



    本博客所有文章如无特别注明均为原创。
    复制或转载请以超链接形式注明转自枫芸志,原文地址《【PhpMyAdmin】mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
    分享:

还没有人抢沙发呢~

无觅相关文章插件,快速提升流量