How to fix ERROR 1201: Could not initialize master info in MySQL

MySQLINTERMEDIATEHIGHUpdated Dec 23, 2025· 150 views

ERROR 1201 occurs in MySQL replication when the slave cannot initialize the master info structure, usually due to corrupted files or previous replication configuration. Reset the slave and reconfigure replication to fix this.

Quick fix

Fixes 1201

STOP SLAVE;
  1. Stop the slave replication
  2. Reset the slave configuration
  3. Verify file permissions
  4. Reconfigure the master connection
mysql — error
STOP SLAVE;
ERROR 1201: Could not initialize master info

What this error means

This error happens during MySQL replication setup when the slave server fails to initialize the master info structure, which stores critical replication metadata like the master host, port, username, and binary log position. The master info structure is essential for the slave to connect to and synchronize with the master database. When MySQL encounters issues reading, writing, or validating this structure—often due to corrupted master.info or relay-log.info files, permission problems, or conflicting previous configurations—it throws ERROR 1201 to prevent replication from starting in an inconsistent state.

Typical symptoms

  • Replication fails to start or initialize during CHANGE MASTER TO command
  • Error appears in MySQL error log when starting the MySQL service after a crash
  • Previous replication configuration still exists on the slave
  • master.info or relay-log.info files are 0 bytes or corrupted
  • SHOW SLAVE STATUS command shows errors or missing values

Common causes

  1. Corrupted or 0-byte master.info or relay-log.info files from unclean shutdown or crash
  2. Incorrect file permissions on master.info, relay-log.info, or relay log files
  3. Previous replication configuration still exists and conflicts with new setup
  4. Corrupted relay log files preventing proper initialization
  5. Missing or invalid relay log files referenced in relay-log.info

How to fix "ERROR 1201: Could not initialize master info"

1Stop the slave replication

Connect to the slave MySQL server and stop replication before making any changes:

sql
STOP SLAVE;

If you are using MySQL 8.0.22 or later, use STOP REPLICA instead:

sql
STOP REPLICA;

Wait for any running SQL statements to complete.

2Reset the slave configuration

Clear the existing master info and relay log files to remove corrupted data:

sql
RESET SLAVE;

For MySQL 8.0.22 or later:

sql
RESET REPLICA;

This command deletes the master.info file, relay-log.info file, and all relay log files. If you need to preserve relay logs for debugging, skip this step and manually delete the files from the MySQL data directory.

3Verify file permissions

Ensure the MySQL user has proper read and write permissions on the data directory:

bash
sudo chown -R mysql:mysql /var/lib/mysql
sudo chmod 750 /var/lib/mysql

Replace /var/lib/mysql with your actual MySQL data directory if different. This is critical for MySQL to create and access the new master.info file.

4Reconfigure the master connection

Establish a new replication connection with correct master parameters:

sql
CHANGE MASTER TO
  MASTER_HOST='your.master.host',
  MASTER_USER='replication_user',
  MASTER_PASSWORD='password',
  MASTER_LOG_FILE='mysql-bin.000001',
  MASTER_LOG_POS=0;

For MySQL 8.0.23 or later, use CHANGE REPLICATION SOURCE instead:

sql
CHANGE REPLICATION SOURCE TO
  SOURCE_HOST='your.master.host',
  SOURCE_USER='replication_user',
  SOURCE_PASSWORD='password',
  SOURCE_LOG_FILE='mysql-bin.000001',
  SOURCE_LOG_POS=0;

Replace the master host, credentials, and log file name with your actual values. Get the correct MASTER_LOG_FILE and MASTER_LOG_POS from the master using SHOW MASTER STATUS.

5Start replication

Start the slave with the new configuration:

sql
START SLAVE;

For MySQL 8.0.22 or later:

sql
START REPLICA;
6Verify replication status

Check that replication is running correctly:

sql
SHOW SLAVE STATUS\G

For MySQL 8.0.22 or later:

sql
SHOW REPLICA STATUS\G

Verify that:
- Slave_IO_Running: Yes (or Replica_IO_Running: Yes)
- Slave_SQL_Running: Yes (or Replica_SQL_Running: Yes)
- Seconds_Behind_Master: 0 or a small number (not NULL)

If either running status is "No", check the error output and consult the MySQL error log.

Advanced notes

If RESET SLAVE alone does not resolve the issue, you may need to manually delete the master.info and relay-log.info files while MySQL is stopped. Locate these files in your MySQL data directory (often /var/lib/mysql) and delete them before restarting MySQL. Some setups use relay-log-recovery, which can help automatically recover from relay log corruption—check your my.cnf for relay-log-recovery=1. In multi-threaded slave setups using parallel SQL threads (slave_parallel_workers), also check for and delete worker.info files. After a crash or unclean shutdown, you may also see "Failed to open the relay log" or similar messages in the error log. These typically resolve once the master.info is successfully reinitialized. If replication remains stuck, examine the full error log for additional context—ERROR 1201 can mask underlying issues like corrupted binary logs on the master or network connectivity problems.

Frequently asked questions

What does "1201" mean?
This error happens during MySQL replication setup when the slave server fails to initialize the master info structure, which stores critical replication metadata like the master host, port, username, and binary log position. The master info structure is essential for the slave to connect to and synchronize with the master database. info files, permission problems, or conflicting previous configurations—it throws ERROR 1201 to prevent replication from starting in an inconsistent state.
How do I fix "1201"?
ERROR 1201 occurs in MySQL replication when the slave cannot initialize the master info structure, usually due to corrupted files or previous replication configuration. Reset the slave and reconfigure replication to fix this.
What causes "1201"?
Corrupted or 0-byte master.info or relay-log.info files from unclean shutdown or crash Incorrect file permissions on master.info, relay-log.info, or relay log files Previous replication configuration still exists and conflicts with new setup
Is the "1201" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading