MySQL master-slave replication. An error is reported when starting slave. Slave failed to initialize relay log info structure from the repository

symptoms:

MySQL master slave copy, when starting slave, the following error occurs:
mysql> start slave;
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

solution: check the log,


can see the error, it was not found originally./server246-relay-bin.index file, find the reason, because I used an instance of cold backup file recovery, in mysql library slave_relay_log_info table still retain the previous relay_log information, so it caused to start slave error.
mysql provides tools for deleting records: slave reset;
slave reset does a few things when executed:
1, delete slave_master_info, slave_relay_log_info in both tables; 2. Delete all relay log files and recreate new relay log files; 3, will not change the value of gtid_executed or gtid_purged

mysql> reset slave;
Query OK, 0 rows affected (0.01 sec)

mysql> change master to ......

mysql> start slave;
Query OK, 0 rows affected (0.00 sec)

So it’s

so that slave can start.

Read More: