Home > Database > Mysql Tutorial > mysql主从库不同步问题解决方法

mysql主从库不同步问题解决方法

WBOY
Release: 2016-06-07 18:03:57
Original
971 people have browsed it

本来配置可以使用的mysql主从库同步的数据库,突然出现无法同步的情况。那么大家可以参考下面的方法解决下。

遇到这样的错误如:“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中执行:"slave stop;"来停止从库同步;

再去master中执行:"flush logs;"来清空日志;

然后在master中执行:"show master status;"查看下主库的状态,主要是日志的文件和position;

然后回到slave中,执行:"CHANGE MASTER TO MASTER_LOG_FILE='log-bin.000004',MASTER_LOG_POS=106;",文件和位置对应master中的;

最后在slave中执行:"slave start;"来启动同步。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template