Unable to load authentication plugin ‘caching_sha2_password‘

本文讲述了如何在Mysql8.0中将用户从caching_sha2_password密码加密方式转换为mysql_native_password,以便于使用DBeaver进行连接,包括修改用户权限和验证字符串的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用DBeaver连接Mysql时报Unable to load authentication plugin 'caching_sha2_password
在这里插入图片描述
原因: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连接啦:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值