连接MySQL错误“plugin caching_sha2_password could not be loaded”的解决办法

参考:https://www.cnblogs.com/live41/p/13833337.html
使用MySQL版本为8.0.26在连接MySQL时报错

原因分析:

MySQL新版默认使用caching_sha2_password作为身份验证插件,而旧版是使用mysql_native_password。
当连接MySQL时报错“plugin caching_sha2_password could not be loaded”时,可换回旧版插件。

解决方法

mysql -hlocalhost -uroot -p123456 //进入数据库
use mysql;
ALTER USER root@localhost IDENTIFIED WITH mysql_native_password BY '123456'; //123456是密码
FLUSH PRIVILEGES
posted @ 2022-02-09 17:46  minseo  阅读(1349)  评论(0)    收藏  举报