mysql出现2058,连接MySQL报“Error No.2058 Plugin caching_sha2_password could not be loaded”错误的解决办法...

点击数:312

原因:

MySQL新版默认使用caching_sha2_password作为身份验证插件,而旧版是使用mysql_native_password

当连接MySQL时报错“plugin caching_sha2_password could not be loaded”时,可换回旧版插件。

ef988e2548bc126ebd3e9a5f9ec1d120.png

解决方法:

1. 远程命令行登录mysql

mysql -hlocalhost -uroot -p123456 -P3306

2. 操作mysql数据库命令:

use mysql;

查看各用户名使用的身份验证插件:

mysql> select Host,User,plugin from mysql.user;

+-----------+------------------+-----------------------+

| Host | User | plugin |

+-----------+------------------+-----------------------+

| % | root | caching_sha2_password |

| localhost | mysql.infoschema | caching_sha2_password |

| localhost | mysql.session | caching_sha2_password |

| localhost | mysql.sys | caching_sha2_password |

| localhost | root | caching_sha2_password |

+-----------+------------------+-----------------------+

3. 修改root用户的本地和远程客户端连接的身份验证插件

本地连接:

alter user root@localhost identified with mysql_native_password by '123456';

FLUSH PRIVILEGES;

远程连接:

alter user root@'%' identified with mysql_native_password by '123456';

FLUSH PRIVILEGES;

4. 此时再次通过客户端登录mysql,问题解决,一切正常

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值