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

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

WBOY
WBOYOriginal
2016-06-01 13:22:10891browse

bitsCN.com 遇到这样的错误如:“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;"来启动同步。bitsCN.com

Statement:
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