Mysql 主从同步之Got fatal error 1236 from master when reading data from binary log: 'Could not find

主从同步出现Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file,则是因为主从日志版本号不一致而导致。解决如下:

查看主日志号
 MariaDB [(none)]> Flush logs;  (这时主服务器会重新创建一个binlog文件;)
 MariaDB [(none)]> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000003 |      385 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.000 sec)

 在从中查看slave日志文件号show slave status\G
   File :mysql-bin.000005
发现是因为主从日志文件号不同而导致 
在从中stop slave;
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

 

上一篇:[论文学习笔记-1] XNOR-net


下一篇:Leetcode No.67 Add Binary二进制求和(c++实现)