报错信息
具体报错信息:Last_IO_Error: error connecting to master ‘haimeng@192.XXX’ - retry-time: 60 retries: 7 message: Authentication plugin ‘caching_sha2_password’ reported error: Authentication requires secure connection.
报错原因:
遇到的问题是关于MySQL的复制配置,特别是使用SSL连接时的问题。错误信息表明,正在尝试使用非安全的连接进行身份验证,而这在MySQL 8.0及更高版本中是不允许的。
具体来说,问题出在MySQL的复制设置中。当使用SSL连接时,MySQL要求使用安全的连接进行身份验证。错误信息中提到的 “Authentication plugin ‘caching_sha2_password’ reported error: Authentication requires secure connection.” 表明了这一点。
解决办法:
方法一
更改身份验证插件
# 修改身份验证插件
ALTER USER 'haimeng'@'192.168.145.130' IDENTIFIED WITH 'mysql_native_password' BY 'password';
#重新加载授权表。当你更改了用户的权限或其他相关的安全设置后,为了让这些更改立即生效,
FLUSH PRIVILEGES;
方法二
1、从机停止主从复制:stop slave
2、重置所有主从复制信息:reset slave
3、重新进行change master to
change master to master_host='192.168.145.130',master_user='mengting',master_password='0123456789',master_log_file='mysql-bin.000011',master_log_pos=156,get_master_public_key=1;
我们在后面添加了:get_master_public_key=1