Description:
Change master need parameter MASTER_SSL or GET_MASTER_PUBLIC_KEY to build a secure connection when the user' auth plugin is caching_sha2_password, or io_thread will connect to server failed after starting slave.
if the replication with caching_sha2_password account start failed due to insecure connection, the show slave status just show "Last_IO_Error: error connecting to master 'repl@127.0.0.1:18001'". error-log also has no Specific information about it.
we can not know why connecting to master failed.
How to repeat:
1. create replication user in master
master:
CREATE USER 'repl'@'%' IDENTIFIED BY 'repl';
grant REPLICATION CLIENT,REPLICATION SLAVE on *.* to 'repl'@'%';
2. change master(insecure connection)
slave:
CHANGE MASTER TO
MASTER_HOST = '127.0.0.1',
MASTER_USER = 'repl',
MASTER_PASSWORD = 'repl',
MASTER_PORT = 3306,
MASTER_AUTO_POSITION = 1;
3. start slave;
4. show slave status
the Last_IO_Error will show "error connecting to master 'repl@127.0.0.1:18001'"
refer to https://bugs.mysql.com/96149
if we connect to server successfully using the user 'repl' before, then 'start slave' will success. The replication will work well both with caching_sha2_password account and insecure connection.
Suggested fix:
'show slave status' show the proper error messge just like "Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection."