MYSQL同步--主从同步问题集锦

1  同步停止,报错误:  Could not find first log file name in binary log index file

数据库主从出错:

 Slave_IO_Running:  No 一方面原因是因为网络通信的问题也有可能是日志读取错误的问题。以下是日志出错问题的解决方案:

 

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

 

解决办法:
从机器停止slave

mysql> slave stop;

 

到master机器登陆mysql:

记录master的bin的位置,例如:mysql> show mster status;
+-------------------+----------+--------------+-------------------------------------------+
| File              | Position | Binlog_Do_DB | Binlog_Ignore_DB                                                                            |
+-------------------+----------+--------------+-------------------------------------------+
| mysqld-bin.000010 |      106 |              | information_schema,mysql |
+-------------------+----------+--------------+-------------------------------------------+
日志为mysqld-bin.000010

 

刷新日志:mysql> flush logs;

因为刷新日志file的位置会+1,即File变成为:mysqld-bin.000011

 

马上到slave执行

mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysqld-bin.000011',MASTER_LOG_POS=106;

mysql> slave start;

mysql> show slave statusG;


转载自:http://happy-xp.blog.163.com/blog/static/2324170201341491015922/

原文地址:https://www.cnblogs.com/catkins/p/5270487.html