当前位置:Gxlcms > 数据库问题 > MySQL-错误:2059 - Authentication plugin 'caching_sha2_password' cannot be loaded

MySQL-错误:2059 - Authentication plugin 'caching_sha2_password' cannot be loaded

时间:2021-07-01 10:21:17 帮助过:4人阅读

MySQL-错误:2059-Authentication plugin ‘caching_sha2_password‘ cannot be loaded

一 现象

使用docker镜像创建容器后,mysql测试连接不成功

技术图片

二 原因

网上查询得到原因:在mysql8之前的版本中加密规则为mysql_native_password,而在mysql8以后的加密规则为caching_sha2_password

确认docker镜像创建容器的mysql为mysql8之后的版本

技术图片

三 解决方案

将mysql的加密规则改回来

grant all on *.* to ‘root‘@‘%‘;  # 授权

flush privileges;

alter user ‘root‘@‘localhost‘ identified by ‘123456‘ password expire never;  # 修改加密规则

ALTER USER ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘123456‘;  # 修改密码

flush privileges;

技术图片

连接成功

技术图片

MySQL-错误:2059 - Authentication plugin 'caching_sha2_password' cannot be loaded

标签:解决   改密码   mys   alt   lte   info   use   使用   roo   

人气教程排行