Authentication-requires-secure-connection

背景

今天帮别人看一个线上的复制报错,报警信息如下

show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Connecting to source
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 2061
                Last_IO_Error: error connecting to master 'repluser@xx.xx.xx.xx:3306' - retry-time: 60 retries: 1 message: Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.

分析

看了一下他的 change 语句

change replication source to 
    source_host = "yy.yy.yy.yy",
    source_port = 3306,
    source_user = "repluser",
    source_password = "dbma@0352",
    source_auto_position = 1

原来是真的没有开 ssl 加密。


解决办法

改一下代码,开启 ssl 。

change replication source to 
    source_host = "127.0.0.1",
    source_port = 3306,
    source_user = "repluser",
    source_password = "dbma@0352",
    source_auto_position = 1,
    source_ssl = 1;

检查

start replica;

show replica status \G
           Replica_IO_Running: Yes
          Replica_SQL_Running: Yes

Authentication-requires-secure-connection