Authentication plugin ‘caching_sha2_password‘ cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
云数据库 RDS MySQL,高可用版 2核4GB 50GB
简介: Authentication plugin ‘caching_sha2_password‘ cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2



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。

执行命令报错,错误信息为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。这是因为 MySQL 8.0 默认使用 caching_sha2_password 插件进行身份验证,而旧的 MySQL 客户端不支持这种插件。

解决该问题可以在 docker-compose.yml 中添加下面的环境变量来指定使用 mysql_native_password 插件进行身份验证:

MYSQL_ROOT_HOST: '%'
MYSQL_USER: root
MYSQL_PASSWORD: rootpassword
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
# Add the following lines to use legacy authentication mode
command: --default-authentication-plugin=mysql_native_password

同时在 MySQL 客户端连接时也需要指定使用 mysql_native_password 插件进行身份验证:

mysql -u root -p --host=127.0.0.1 --port=3306 --protocol=tcp --default-auth=mysql_native_password

这样应该可以成功连接到 MySQL 服务器了。

或者第二种解决方式是执行以下命令:

docker exec -it mysql-master-1 bash
mysql -u root -p
# 输入密码后执行以下命令
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'masterroot';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'masterroot';
FLUSH PRIVILEGES;
EXIT;



相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
1月前
|
关系型数据库 MySQL 数据安全/隐私保护
关于Navicat连接MySQL 报 Authentication plugin ‘caching_sha2_password‘ cannot be loaded
关于Navicat连接MySQL 报 Authentication plugin ‘caching_sha2_password‘ cannot be loaded
|
1月前
|
关系型数据库 MySQL 数据安全/隐私保护
MySQL连接ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password‘ cannot be loaded
MySQL连接ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password‘ cannot be loaded
49 0
|
11月前
|
SQL 关系型数据库 MySQL
Blueprints MySQL Connector / UE4 | DTMysql plugin instructions
Blueprints MySQL Connector / UE4 | DTMysql plugin instructions
50 0
|
12月前
|
数据可视化 关系型数据库 MySQL
解决用软件登陆的Mysql8数据库时,报错:Authentication plugin ‘caching_sha2_password‘ cannot be loaded
解决用软件登陆的Mysql8数据库时,报错:Authentication plugin ‘caching_sha2_password‘ cannot be loaded
513 0
解决用软件登陆的Mysql8数据库时,报错:Authentication plugin ‘caching_sha2_password‘ cannot be loaded
|
Oracle 关系型数据库 MySQL
迁移MariaDB审计插件(Audit Plugin)到MySQL 5.7---发表到爱可生开源社区
Oracle的MySQL社区版本不带审计插件(Audit Plugin),要想使用审计功能,你可以用Enterprise的版本,不过这需要银子。业界还有一些GPL协议的审计插件,这里我们选择MariaDB的审计插件。
161 0
|
关系型数据库 MySQL
MySQL 连接出现 Authentication plugin 'caching_sha2_password' cannot be loaded
MySQL 连接出现 Authentication plugin 'caching_sha2_password' cannot be loaded
212 0
|
关系型数据库 MySQL SQL
新功能初探 | MySQL 8.0.17重量级功能:clone plugin
MySQL8.0.17推出了一个重量级的功能:clone plugin。允许用户可以将当前实例进行本地或者远程的clone。这在某些场景尤其想快速搭建复制备份或者在group replication里加入新成员时非常有用。本文主要试玩下该功能,并试图阐述下其实现的机制是什么。
977 0
|
关系型数据库 MySQL SQL
MySQL8.0.17 - 初探 Clone Plugin
MySQL8.0.17推出了一个重量级的功能:clone plugin。允许用户可以将当前实例进行本地或者远程的clone。这在某些场景尤其想快速搭建复制备份或者在group replication里加入新成员时非常有用。
3195 0
|
关系型数据库 MySQL Windows
2059 - authentication plugin 'caching_sha2_password'” mysql8.0 Navicat for mysql 登陆错误
最近在windows服务器部署最新版mysql8.0时发现 navicat for mysql登陆不了。 根据错误提示 2059 - authentication plugin 'caching_sha2_password'” 搜索得知,原来是新版mysql8.0登陆验证改变导致的。
4737 0
|
1天前
|
关系型数据库 MySQL 分布式数据库
PolarDB产品使用问题之要验证MySQL迁移后的数据库数据与迁移前的数据一致性,该怎么办
PolarDB产品使用合集涵盖了从创建与管理、数据管理、性能优化与诊断、安全与合规到生态与集成、运维与支持等全方位的功能和服务,旨在帮助企业轻松构建高可用、高性能且易于管理的数据库环境,满足不同业务场景的需求。用户可以通过阿里云控制台、API、SDK等方式便捷地使用这些功能,实现数据库的高效运维与持续优化。
PolarDB产品使用问题之要验证MySQL迁移后的数据库数据与迁移前的数据一致性,该怎么办

热门文章

最新文章