Get the App
SLTechnology News&Howtos  ›  Database  › 

[Mysql] ERROR 1872 (HY000): Slave failed to initialize relay log info

Shulou Source: shulou.com Published: 2022-06-01 05:19:10 10月03日 Update

Background: after migrating the database directory to another k directory online, the slave process reports an error:

Start slave

ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

Solution:

Modify the records in the index file and info file index to be [root@Yun-MySQL02 3306] # more mysqlrelay.index of the original directory

/ data/mydata/3306/mysqlrelay.000006-modify it to the new relay log directory

/ databak/3306/mysqlrelay.000007

/ databak/3306/mysqlrelay.000008

/ databak/3306/mysqlrelay.000009

/ databak/3306/mysqlrelay.000010

[root@Yun-MySQL02 3306] # more relay-log.info

seven

/ databak/3306/mysqlrelay.000007-modify to the new relay log directory

29378841

Mysql-bin.000051

706927394

0

0

one

Note: there may be environments where relay-log.info cannot be found because of parameter settings

Before MySQL 5.6.2, the master information recorded by slave and the information of slave application binlog were stored in files, namely master.info and relay-log.info. After version 5.6.2, logging is allowed in table with the following parameters:

Master-info-repository = TABLE-FILE means as a file

Relay-log-info-repository = TABLE-FILE means as a file

The corresponding tables are mysql.slave_master_info and mysql.slave_relay_log_info, and both tables are innodb engine tables.

Mysql > select * from mysql.slave_master_info\ G:

* * 1. Row *

Number_of_lines: 23

Master_log_name: mysql-bin.000129

Master_log_pos: 760146983

Host: 192.168.10.1

User_name: repl

User_password: aaafdffdgbh_$3KFUH

Port: 3307

Connect_retry: 60

Enabled_ssl: 0

Ssl_ca:

Ssl_capath:

Ssl_cert:

Ssl_cipher:

Ssl_key:

Ssl_verify_server_cert: 0

Heartbeat: 1800

Bind:

Ignored_server_ids: 0

Uuid: 6c8a10ed-ed0b-11e4-91eb-00163ec546aa

Retry_count: 86400

Ssl_crl:

Ssl_crlpath:

Enabled_auto_position: 1

1 row in set (0.07 sec)

Mysql > show variables like 'relay%'

+-+

| | Variable_name | Value |

+-+

| | relay_log | / databak/3306/mysqlrelay |

| | relay_log_basename | / databak/3306/mysqlrelay |

| | relay_log_index | / databak/3306/mysqlrelay.index |

| | relay_log_info_file | relay-log.info |

| | relay_log_info_repository | FILE |

| | relay_log_purge | ON |

| | relay_log_recovery | OFF |

| | relay_log_space_limit | 0 | |

+-+

Tags: File directory information parameter method log relay two method reason engine data database version environment background process not for online application Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB MySQL Microsoft Xiaomi Apple