Unable to load authentication plugin ‘caching_sha2_password‘

使用DBeaver连接Mysql时报Unable to load authentication plugin 'caching_sha2_password
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连接啦:
Unable to load authentication plugin ‘caching_sha2_password‘

上一篇:CF94A Restoring Password 题解


下一篇:2.4 OpenEuler中C语言中的函数调用测试