侧边栏壁纸
博主头像
Tony's Blog博主等级

行动起来,coding

  • 累计撰写 83 篇文章
  • 累计创建 58 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

Unable to load authentication plugin ‘caching_sha2_password‘

Tony
2024-02-23 / 0 评论 / 0 点赞 / 3 阅读 / 5288 字

本文链接: https://blog.csdn.net/lishuangquan1987/article/details/121974655

版权

使用DBeaver连接Mysql时报 Unable to load authentication plugin 'caching_sha2_password

1-wwjq.png

原因:Mysql8.0以上默认使用密码加密规则为 caching_sha2_password

需要修改为 mysql_native_password:

 use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user,host,plugin,authentication_string from user;
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| user             | host      | plugin                | authentication_string                                                  |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| root             | %         | caching_sha2_password | $A$005$v8lm8j[1U_iz%?rhHztGex9Z6H74IQjIOkhc6V3y/PPZnVGuHIeuWJtXLe/ |
| test             | %         | caching_sha2_password | $A$005$?Eq\nQzL}}th,b0WMVhOhTrGCDok8A7R.HPSm/nHnzwfVH0fiufJEjAkD |
| mysql.infoschema | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session    | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys        | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| root             | localhost | caching_sha2_password | $A$005$x{eSdQq9(@)>rzX&p5FhZqlP0p6BNJgunFY9FWjw8JlqywS5ANOdxzCODfZD |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
6 rows in set (0.00 sec)
mysql> alter user 'test'@'%' identified with mysql_native_password by 'Test@123';
Query OK, 0 rows affected (0.01 sec)

mysql> select user,host,plugin,authentication_string from user;
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| user             | host      | plugin                | authentication_string                                                  |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
| root             | %         | caching_sha2_password | $A$005$v8lm8j[1U_iz%?rhHztGex9Z6H74IQjIOkhc6V3y/PPZnVGuHIeuWJtXLe/ |
| test             | %         | mysql_native_password | *BCF4F28E525ED7EE4664FFFF4DAE13EC14A6ABE1                              |
| mysql.infoschema | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session    | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys        | localhost | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| root             | localhost | caching_sha2_password | $A$005$x{eSdQq9(@)>rzX&p5FhZqlP0p6BNJgunFY9FWjw8JlqywS5ANOdxzCODfZD |
+------------------+-----------+-----------------------+------------------------------------------------------------------------+
6 rows in set (0.00 sec)

可以看到test用户的plugin变为 mysql_native_password

这样就能用DBeaver连接啦:

2-kzjn.png

0

评论区