ERROR 2061 (HY000): Authentication plugin ‘caching_sha2_password

mysql -uroot -p 登录mysql 时报错:ERROR 2061 (HY000): Authentication plugin ‘caching_sha2_password’ reported error:
解决步骤:

  1. 停止MySQL服务。
  2. 启动MySQL服务时,需要使用–skip-grant-tables选项来跳过权限检查,这样你就可以无需密码登录MySQL服务器。

在Linux系统中,如果你使用的是系统自带的MySQL服务管理工具(如systemd或init.d),你可以通过编辑MySQL的配置文件来添加–skip-grant-tables选项。通常MySQL的配置文件位于/etc/my.cnf或/etc/mysql/my.cnf。你可以在配置文件的[mysqld]部分添加以下行:
skip-grant-tables
然后重启MySQL服务。

在Windows系统中,如果你是通过MySQL Server安装程序安装的MySQL,你可以通过MySQL服务的属性来添加–skip-grant-tables选项。你可以在"服务"管理工具中找到MySQL服务,然后右键点击"属性",在"启动参数"中添加–skip-grant-tables,然后重启MySQL服务。

请注意,使用–skip-grant-tables选项启动MySQL服务时,所有用户都可以无需密码登录MySQL服务器,并且权限检查被禁用。因此,在完成密码认证插件的修改后,一定要记得移除这个选项并重新启动MySQL服务,以恢复正常的权限检查。

  1. 登录 :
mysql -uroot
  1. 运行SQL语句来修改密码认证插件
UPDATE mysql.user SET plugin='mysql_native_password' WHERE User='username' AND Host='host';

将username和host替换为你的实际用户名和主机名,查看用户名和主机名

SELECT user, host FROM mysql.user;

5.刷新权限:

FLUSH PRIVILEGES;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
当你看到ERROR 2061 (HY000): Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.的错误信息时,它表示MySQL数据库配置了caching_sha2_password认证插件,并要求使用安全连接进行身份验证。这个错误通常发生在尝试连接到MySQL服务器时,但没有使用加密连接。为了解决这个问题,你可以采取以下步骤: 1. 确保你的MySQL客户端和服务器都支持SSL/TLS加密。这可以通过检查它们的版本和配置来确认。 2. 在连接MySQL服务器时,确保使用了安全连接。这意味着你需要使用SSL/TLS协议来加密通信。你可以在连接字符串或命令行选项中指定使用SSL/TLS。 3. 如果你正在使用命令行客户端,可以在连接MySQL服务器时使用--ssl选项来启用安全连接。例如,mysql --ssl=1 -u username -p。 4. 如果你使用的是应用程序或框架,查看它们的文档以了解如何配置和启用安全连接。 总之,当你遇到ERROR 2061 (HY000): Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.的错误时,你需要确认你的MySQL客户端和服务器都支持SSL/TLS加密,并使用安全连接来连接MySQL服务器。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [ERROR 2061 (HY000): Authentication plugincaching_sha2_password‘ reported error: Authentication](https://blog.csdn.net/hezuijiudexiaobai/article/details/131258873)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [主从复制报错2061Authentication plugin 'caching_sha2_password' reported error:Authentication ...](https://blog.csdn.net/weixin_30647423/article/details/114816675)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值