mysql 从库重启,配置失败,报错:Slave: Failed to initialize the master info structure for channel?

系统:window 10
mysqld版本: 8.0.12

从库中设置链接主库

reset slave;

CHANGE MASTER TO
MASTER_HOST='192.168.1.100',
MASTER_USER='replication',
MASTER_PASSWORD='EnterSecurePasswordHere',
MASTER_PORT=3306,
MASTER_AUTO_POSITION = 1;

start slave;

show slave status;

以上设置成功,数据同步也没问题,mysql.slave_master_infomysql.slave_relay_log_info表中配置数据正常。

但是,一旦重启 slave,就报以下错误,master配置信息失效

[ERROR] [MY-010728] [Repl] Error writing master configuration.
[ERROR] [MY-010729] [Repl] Error reading master configuration.
[ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-000029 - File '.\X1C-relay-bin-@00020.index' not found (OS errno 2 - No such file or directory)
[ERROR] [MY-010605] [Repl] Failed in open_index_file() called from Relay_log_info::rli_init_info().
[ERROR] [MY-010426] [Repl] Slave: Failed to initialize the master info structure for channel '                                                                '; its record may still be present in 'mysql.slave_master_info' table, consider deleting it.
[ERROR] [MY-013123] [Repl] Slave I/O for channel '                                                                ': Slave failed to initialize master info structure from the repository, Error_code: MY-013123
[ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001871 - Slave failed to initialize master info structure from the repository
[ERROR] [MY-011025] [Repl] Failed to start slave threads for channel '                                                                '.
[System] [MY-010931] [Server] C:\mysql\Extensions\MySQL8.0.12\\bin\mysqld.exe: ready for connections. Version: '8.0.12'  socket: ''  port: 3306  MySQL Community Server - GPL.

更让我不理解的是,重启后马上执行 show slave status;显示下面信息:

+----------------+---------------------------------------------------------------------------+-------------+-------------+---------------+
| Slave_IO_State | Master_Host                                                               | Master_User | Master_Port | Connect_Retry |
+----------------+---------------------------------------------------------------------------+-------------+-------------+---------------+
|                | 192.168.1.100                                                  replication |             |        3306 |            60 |
+----------------+---------------------------------------------------------------------------+-------------+-------------+---------------+

Master_Host 字段中,混杂了 master的IP和用户名,中间有大量空格,而Master_User字段为空,令我不解


在我google的时候,看到有人说是 master.info问题,但我并没有配置 master-info-file,且mysql 8.0开始,已经默认是master_info_repository=TABLErelay_log_info_repository=TABLE,参考:17.2.4.2 Replication Metadata Repositories

阅读 3.8k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题