MySQL8.0远程连接报错Authentication plugin 'caching_sha2_password'解决方法

参考:
https://blog.csdn.net/ZHY_ERIC/article/details/124470136
MySQL8.0远程连接报错

ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

原因是:mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password。
解决方法
进入MySQL

# mysql -uroot -p

修改账户密码加密规则并更新用户密码:

# 修改加密规则
 
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
 
# 更新一下用户的密码
 
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

刷新权限并重置密码

# 刷新权限(可以直接复制)
 
flush privileges;

重置密码

#自定义密码
 
alter user 'root'@'localhost' identified by 'dgdggdgdg';
posted @   minseo  阅读(1390)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
点击右上角即可分享
微信分享提示