Common SQL Errors

MySQL Error 1871: ER_SLAVE_MI_INIT_REPOSITORY - How to Fix Slave Master Info Repository Initialization Failure

Galaxy Team
August 8, 2025

Replication slave cannot create or access the master_info repository table or file, so replication stops at startup.

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 1871 ER_SLAVE_MI_INIT_REPOSITORY?

MySQL error ER_SLAVE_MI_INIT_REPOSITORY (1871) appears when the replication slave cannot initialize the master_info repository table or file. Check that the mysql.slave_master_info table exists, storage is writable, and the master_info_repository variable is set correctly, then recreate or repair the repository to resume replication.

Error Highlights

Typical Error Message

ER_SLAVE_MI_INIT_REPOSITORY

Error Type

Replication Error

Language

MySQL

Symbol

repository ER_SLAVE_MI_INIT_REPOSITORY was added in 5.7.2.

Error Code

1871

SQL State

HY000

Explanation

Table of Contents

What does ER_SLAVE_MI_INIT_REPOSITORY mean?

MySQL raises error 1871 when the replication slave cannot initialize the master_info repository that stores connection credentials and replication positions. Without this structure, the IO thread cannot start, and replication halts.

When does MySQL raise error 1871?

The message appears during START SLAVE, CHANGE MASTER TO, or server startup when master_info_repository=TABLE or FILE cannot be read, written, or created inside the data directory.

Why should you fix it quickly?

Replication lag grows as the slave stays offline. Applications depending on read-only replicas lose consistency, and failover plans become risky, so immediate remediation is essential.

What Causes This Error?

Most cases involve missing or corrupted mysql.slave_master_info tables, file permission problems, or mismatched MySQL versions after an upgrade.

How to Fix ER_SLAVE_MI_INIT_REPOSITORY

Repair or recreate the repository, verify filesystem permissions, and re-issue CHANGE MASTER TO statements with the correct connection parameters.

Common Scenarios and Solutions

Different environments surface this error after server crashes, filesystem restores, or switching master_info_repository modes. Each scenario requires a targeted set of steps outlined below.

Best Practices to Avoid This Error

Schedule regular mysqlcheck and mysql_upgrade runs, employ proper backup strategies, and monitor the error log for early warnings.

Related Errors and Solutions

Replication repository problems can also trigger ER_SLAVE_RLI_INIT_REPOSITORY (1872) and ER_SLAVE_START_FAIL. Fixing the underlying metadata tables often clears all related issues.

Common Causes

Missing slave_master_info table

The mysql.slave_master_info table was accidentally dropped or never created after an upgrade.

File permission issues

The MySQL process cannot read or write files inside the data directory because of OS-level permission or SELinux restrictions.

Corrupted InnoDB dictionary

Crash recovery left the repository table inconsistent, preventing InnoDB from opening it.

Wrong master_info_repository setting

The server starts with TABLE but the underlying table is missing, or with FILE but the .info file path is invalid.

Related Errors

ER_SLAVE_RLI_INIT_REPOSITORY (1872)

Raised when the slave cannot initialize the relay log repository (slave_relay_log_info). The troubleshooting approach mirrors that of ER_SLAVE_MI_INIT_REPOSITORY.

ER_SLAVE_START_FAIL

Occurs when START SLAVE fails for generic reasons, often following repository initialization issues.

ER_MASTER_INFO

Indicates problems reading the master.info file in FILE mode replication setups.

FAQs

Does this error affect GTID replication?

Yes. The slave still needs the master info repository to store GTID positions. Without it, auto-positioning cannot proceed.

Can I switch from TABLE to FILE to bypass the error?

Only if FILE mode suits your environment and filesystem permissions are correct. Otherwise, you risk moving the problem instead of solving it.

Will RESET SLAVE ALL delete data?

It removes replication metadata but not user data. Always have backups before resetting to avoid unintended side effects.

How does Galaxy help prevent this?

Galaxy’s editor highlights replication errors instantly, surfaces log snippets, and lets teams share vetted recovery scripts, reducing downtime.

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