Last_IO_Error: Got fatal error 1236 from source when reading data from binary log: 'Could not find first log file name in binary log index file'

Replica’s IP address was changed so it went out of sync and can’t re-sync automatically as bin log file no longer exists on the source. I’ve been reading other posts with similar issues but I couldn’t find a solution.

I want to avoid recreating replica. Is there a way we could start syncing replica from the most recent bin log files on source? Can I run following command, will it work?

# stop slave
mysql> stop slave;
 
# make slave forget its replication position in the master's binary log
mysql> reset slave;
 
# change slave to start reading from new/most recent position
mysql> change master to master_log_file='mysql-bin.000084', master_log_pos=0;
 
# start slave
mysql> start slave;

Replica

mysql> show replica status\G
*************************** 1. row ***************************
             Replica_IO_State: 
                  Source_Host: sss.sss.sss.sss
                  Source_User: repl
                  Source_Port: 3306
                Connect_Retry: 60
              Source_Log_File: mysql-bin.000048
          Read_Source_Log_Pos: 453572928
               Relay_Log_File: mysql-relay-bin.000180
                Relay_Log_Pos: 453573144
        Relay_Source_Log_File: mysql-bin.000048
           Replica_IO_Running: No
          Replica_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Source_Log_Pos: 453572928
              Relay_Log_Space: 453574404
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Source_SSL_Allowed: No
           Source_SSL_CA_File: 
           Source_SSL_CA_Path: 
              Source_SSL_Cert: 
            Source_SSL_Cipher: 
               Source_SSL_Key: 
        Seconds_Behind_Source: NULL
Source_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 13114
                Last_IO_Error: Got fatal error 1236 from source when reading data from binary log: 'Could not find first log file name in binary log index file'
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Source_Server_Id: 1
                  Source_UUID: 4dgdttyt40
             Source_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
    Replica_SQL_Running_State: Replica has read all relay log; waiting for more updates
           Source_Retry_Count: 86400
                  Source_Bind: 
      Last_IO_Error_Timestamp: 240725 19:33:52
     Last_SQL_Error_Timestamp: 
               Source_SSL_Crl: 
           Source_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Source_TLS_Version: 
       Source_public_key_path: 
        Get_Source_public_key: 0
            Network_Namespace: 
1 row in set (0.00 sec)

Source

mysql> SHOW BINARY LOGS;
+------------------+------------+-----------+
| Log_name         | File_size  | Encrypted |
+------------------+------------+-----------+
| mysql-bin.000069 | 1073742216 | No        |
| mysql-bin.000070 | 1063423287 | No        |
| mysql-bin.000071 |       2201 | No        |
| mysql-bin.000072 | 1073745462 | No        |
| mysql-bin.000073 | 1073750123 | No        |
| mysql-bin.000074 | 1073744829 | No        |
| mysql-bin.000075 | 1073745754 | No        |
| mysql-bin.000076 | 1073742823 | No        |
| mysql-bin.000077 |  451660096 | No        |
| mysql-bin.000078 |        695 | No        |
| mysql-bin.000079 |  365140874 | No        |
| mysql-bin.000080 |     290719 | No        |
| mysql-bin.000081 |  241068225 | No        |
| mysql-bin.000082 |    2082703 | No        |
| mysql-bin.000083 |     260087 | No        |
| mysql-bin.000084 |   67113277 | No        |
+------------------+------------+-----------+
16 rows in set (0.00 sec)

mysql> show master status\G
*************************** 1. row ***************************
             File: mysql-bin.000084
         Position: 69092924
     Binlog_Do_DB: 
 Binlog_Ignore_DB: 
Executed_Gtid_Set: 
1 row in set (0.00 sec)

Sorry, that’s what you really need to do.

Yes, it will work. Will there be missing data on your replica if you do that? 100% guaranteed.

The only correct way to fix replication in this situation is to rebuild the replica.