> 系统: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_info`,`mysql.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=TABLE` 和 `relay_log_info_repository=TABLE`,参考:[17.2.4.2 Replication Metadata Repositories](https://link.segmentfault.com/?enc=pTorkpxRsHgfmE3cohOBJg%3D%3D.8WCuleBtENkNCaGw3WmIqaAUYBU6r6VSWYg8ALqWyu7CNe%2F8OufMKibTq8mfw04Qg45ZWtrEXZzz5IVggIETbVviqRquMtttVT4iArdX0EE%3D)