MySQL replication error 1594

In a MySQL master-slave replication setup, if relay log files corrupted on the slave server’s filesystem replication status becomes as:

  • Slave_IO_Running => Yes
  • Slave_SQL_Running => No
  • Last_SQL_Errno => 1594

If you have the same problem you can fix the replication with following steps:

  1. Check the slave status output and save the values of Relay_Master_Log_File and Exec_Master_Log_Pos variables:

    SHOW SLAVE STATUS\G

    Relay_Master_Log_File: mysql-bin.000278
    Exec_Master_Log_Pos: 58392316

  2. After that stop the slave node:

    STOP SLAVE;

  3. Reset replication (removes all the binlogs after the replication stop point):

    RESET SLAVE;

  4. Change the master_log_file and master_log_pos variables of current replication setup with the values you save on first step like that:

    CHANGE MASTER TO MASTER_LOG_FILE=‘mysql-bin.000278’, MASTER_LOG_POS=58392316;

  5. Start the replication again:

    START SLAVE;

Everything should be ok.