代码改变世界

【MySQL】Authentication plugin 'caching_sha2_password' reported error

  abce  阅读(1614)  评论(0编辑  收藏  举报

使用MySQL8.0.30创建主从,启动从库的时候报错:

1
2
Last_IO_Errno:2061
Last_IO_Error:error connecting to mater 'repl@xxxxx:3308' - retry-time:60 retries:1 massage:Authentication plugin 'caching_sha2_password' reported error:Authentication require secure connection.

 

原因是在MySQL8之前,身份验证插件默认是mysql_native_password;而从8.0开始,换成了caching_sha2_password。

 

1.可以在mysql server的配置文件中,继续使用旧的验证插件。在配置文件中即可。

1
2
[mysqld]
default_authentication_plugin=mysql_native_password

 

2.也可以在用户级别进行修改,修改用户使用的验证插件即可:

1
2
3
alter user '[username]'@'[host]' \
identified with mysql_native_password \
by '[password]';

 

3.也可以使用GET_MASTER_PUBLIC_KEY=1,请求公钥:

1
mysql> change master to master_host='xxxx', master_port=3308, master_user='repl', master_password='pwd',master_auto_position = 1,get_master_public_key=1;

  


相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2018-09-02 mysql optimize table
2015-09-02 11G新特性 -- OLTP Table Compression
2015-09-02 11G新特性 -- 收缩临时表空间
点击右上角即可分享
微信分享提示