Common SQL Errors

MySQL Error 1872: ER_SLAVE_RLI_INIT_REPOSITORY - How to Fix and Prevent

Galaxy Team
August 8, 2025

The MySQL replication slave cannot initialize the relay log info repository, stopping replication from starting.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1872 ER_SLAVE_RLI_INIT_REPOSITORY?

MySQL error 1872 ER_SLAVE_RLI_INIT_REPOSITORY occurs when a replication slave fails to create or load its relay-log-info repository. Recreate the missing tables or files, reset the slave, and restart replication to fix the issue.

Error Highlights

Typical Error Message

ER_SLAVE_RLI_INIT_REPOSITORY

Error Type

Replication Error

Language

MySQL

Symbol

the repository ER_SLAVE_RLI_INIT_REPOSITORY was added in 5.7.2.

Error Code

1872

SQL State

HY000

Explanation

Table of Contents

What is MySQL error 1872 ER_SLAVE_RLI_INIT_REPOSITORY?

Error 1872 is raised by a MySQL replication slave that cannot build or read the internal relay log info repository introduced in MySQL 5.7.2. Without this structure, the slave IO and SQL threads refuse to start, halting replication.

The repository can live in a file or in two internal tables (mysql.slave_relay_log_info and mysql.slave_worker_info). If either storage method is missing or corrupted, MySQL throws this error during START SLAVE or server startup.

Why is fixing error 1872 important?

Replication lag grows immediately because the slave stops processing relay logs. Applications that rely on read scaling or high availability lose redundancy. Ignoring the issue risks data drift and prolonged downtime.

What Causes This Error?

Missing mysql.slave_relay_log_info and mysql.slave_worker_info tables prevent the slave from persisting relay log positions in TABLE mode.

Incorrect file permissions or an invalid path keep the server from creating the relay-log-info file in FILE mode.

A previous crash can corrupt the repository tables or the relay-log-info file, making them unreadable on restart.

Changing relay_log_info_repository or transaction_write_set_extraction without recreating the repository also triggers the error.

How to Fix MySQL error 1872 ER_SLAVE_RLI_INIT_REPOSITORY

Confirm which repository type your server expects and recreate the missing structure. Then restart replication and verify position consistency.

Common Scenarios and Solutions

TABLE repository missing after upgrade - create the tables with mysql_upgrade or manually with the provided DDL, then run START SLAVE.

FILE repository path invalid - update relay_log_info_file or fix permissions, remove damaged file, and start the slave to generate a new one.

Crash-induced corruption - reset the slave, purge relay logs, and let the master resend data.

Best Practices to Avoid This Error

Automate mysql_upgrade after every version upgrade to create any new replication tables.

Store repository tables on durable storage and back them up with the data directory.

Monitor SHOW SLAVE STATUS and error logs for early warnings about repository problems.

Related Errors and Solutions

Error 1201 HY000: Could not find target log during relay log initialization - usually follows error 1872 when relay logs are missing.

Error 1874 ER_REPLICA_FAILED_TO_CREATE_LOG - indicates failure to create relay log files, often tied to permission issues.

Common Causes

Missing repository tables

The tables mysql.slave_relay_log_info and mysql.slave_worker_info do not exist because mysql_upgrade was skipped.

Invalid file path or permissions

The relay-log-info file cannot be created in the configured directory because MySQL lacks write permissions or the path is wrong.

Repository corruption after crash

A sudden shutdown corrupted the existing repository files or tables, making them unreadable.

Configuration mismatch

relay_log_info_repository was changed from FILE to TABLE or vice versa without rebuilding the repository.

Related Errors

MySQL Error 1201: ER_MASTER_INFO

Raised when the replica cannot find the specified binlog on the master. Often follows repository issues.

MySQL Error 1874: ER_REPLICA_FAILED_TO_CREATE_LOG

Occurs when the slave fails to create relay logs, typically because of disk space or permission problems.

MySQL Error 1873: ER_SLAVE_MULTIPLE_CHANNELS_HOST_PORT

Thrown when multiple replication channels conflict; may appear alongside repository initialization failures.

FAQs

Do I need to rebuild the entire replica?

No. If you recreate the repository tables or file and positions are intact, you can usually START SLAVE without a full rebuild.

Will RESET SLAVE erase data?

RESET SLAVE ALL deletes replication metadata and relay logs but leaves existing database data untouched.

How can Galaxy help with this error?

Galaxy's integrated error surfacing highlights relay log issues in real time and offers AI-generated fixes, reducing troubleshooting time.

Is this error specific to MySQL 5.7?

The repository was introduced in 5.7.2, but the error can appear in all later versions, including MySQL 8.x.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo