MySQL新版默認使用caching_sha2_password作爲身份驗證插件,而舊版是使用mysql_native_password
當連接MySQL時報錯“plugin caching_sha2_password could not be loaded”時,可換回舊版插件。
操作mysql數據庫命令:
use mysql;
查看用戶名使用的身份驗證插件:
mysql> select Host,User,plugin from mysql.user;
mysql> select Host,User,plugin from mysql.user;
+-----------+------------------+-----------------------+
| Host | User | plugin |
+-----------+------------------+-----------------------+
| % | bg | caching_sha2_password |
| % | rot | mysql_native_password |
| localhost | deaint | caching_sha2_password |
| localhost | mema | caching_sha2_password |
| localhost | msion | caching_sha2_password |
| localhost | mys | caching_sha2_password |
+-----------+------------------+-----------------------+
6 rows in set (0.00 sec)
修改root用戶的身份驗證插件
本地連接:
alter user rootidentified with mysql_native_password by '123';
alter user root@localhost identified with mysql_native_password by '123';
FLUSH PRIVILEGES;
鏈接:https://blog.csdn.net/qq_54202620/article/details/122729704