【navicat 连接错误】2059 - authentication plugin ‘caching_sha2_password‘的解决方法

Navicat 连接MySQL数据库出现错误:2059 - authentication plugin 'caching_sha2_password’的解决方法
错误原因:MySQL新版本(8以上版本)的用户登录账户加密方式是【caching_sha2_password】,Navicat不支持这种用户登录账户加密方式。

解决方式:

进入mysql 命令界面:

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

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


修改root 用户 加密方式

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'MyNewPass4!';
Query OK, 0 rows affected (0.02 sec)

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

mysql>

可以看到已经改了过来,mysql_native_password

再用navicat 连接即可成功!
————————————————
版权声明:本文为CSDN博主「东华果汁哥」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u013421629/article/details/119328870

posted @ 2023-07-17 14:25  疯子110  阅读(1079)  评论(0编辑  收藏  举报