[MySQL]Authentication plugin 'caching_sha2_password' reported error:Authentication require secure connection.

1. 问题描述

使用MySQL8.0.30创建主从,启动从库的时候报错:
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.

2. RC

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

3. solution

1). 可以在mysql server的配置文件中,继续使用旧的验证插件。在配置文件中即可。
[mysqld]
default_authentication_plugin=mysql_native_password
2). 也可以在用户级别进行修改,修改用户使用的验证插件即可:

alter user 'username'@'host' identified with mysql_native_password by 'password';

3). 主从复制报错也可以使用GET_MASTER_PUBLIC_KEY=1,请求公钥:

change master to master_host='xxxx', master_port=3308, master_user='repl', master_password='pwd',master_auto_position = 1,get_master_public_key=1;
posted @ 2024-06-25 13:24  DBer_ablewang  阅读(31)  评论(0编辑  收藏  举报