MySql教程

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

本文主要是介绍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

 

这篇关于Mysql 主从同步之Got fatal error 1236 from master when reading data from binary log: 'Could not find的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!