MySQL 8.0报错:ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u012611878/article/details/80721220

报错信息:

error 2059: Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory 

原因:

    mysql> select version();  
    +-----------+  
    | version() |  
    +-----------+  
    | 8.0.11    |  
    +-----------+  
    1 row in set (0.00 sec)  

    mysql> show variables like 'default_authentication_plugin';  
    +-------------------------------+-----------------------+  
    | Variable_name                 | Value                 |  
    +-------------------------------+-----------------------+  
    | default_authentication_plugin | caching_sha2_password |  
    +-------------------------------+-----------------------+  
    1 row in set (0.01 sec)  

    mysql> select host,user,plugin from mysql.user;  
    +-----------+------------------+-----------------------+  
    | host      | user             | plugin                |  
    +-----------+------------------+-----------------------+  
    | %         | root             | caching_sha2_password |  
    | localhost | mysql.infoschema | mysql_native_password |  
    | localhost | mysql.session    | mysql_native_password |  
    | localhost | mysql.sys        | mysql_native_password |  
    | localhost | root             | caching_sha2_password |  
    +-----------+------------------+-----------------------+  
    5 rows in set (0.00 sec)  

可以看到MySQL8.0.11版本默认的认证方式是caching_sha2_password,连接不上的原因在于连接数据库工具不支持该格式的密码。

解决方法:

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';

修改密码加密方式

展开阅读全文

没有更多推荐了,返回首页