Got fatal error 1236 from master when reading data from binary log:’Could not find first log file name in binary log index file’ occurs in master-slave synchronization, it is caused by inconsistent master-slave log version numbers. The solution is as follows:
View the main log number MariaDB [(none)] > Flush logs; (At this time, the main server will recreate a binlog file;) MariaDB [(none)]> show master status; +------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +------------------+----------+--------------+---- --------------+ | mysql-bin.000003 | 385 | | | +------------------+----------+--------------+---- --------------+ 1 row in set (0.000 sec) View the slave log file number from show slave status\G File :mysql-bin.000005 It was found that the master and slave log file numbers were different. Stop slave from it;
MariaDB [(none)]> change master to master_log_file ='dbmaster-bin.000005',master_log_pos=120;
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> start slave;
MariaDB [(none)]> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 192.168.220.130 Master_User: test Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000003 Read_Master_Log_Pos: 385 Relay_Log_File: mysqld-relay-bin.000002 Relay_Log_Pos: 555 Relay_Master_Log_File: mysql-bin.000003 Slave_IO_Running: Yes Slave_SQL_Running: Yes