在设置mysql主从的时候,发现slave的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
错误原因在于binlog未同步。
解决方法:
先进入slave中执行:"slave stop;"来停止从库同步;
再去master中执行:"flush logs;"来清空日志;
然后在master中执行:"show master status;"查看下主库的状态,主要是日志的文件和position;
然后回到slave中,执行:"CHANGE MASTER TO MASTER_LOG_FILE='log-bin.00000x',MASTER_LOG_POS=106;",文件和位置对
应master中的;
最后在slave中执行:"slave start;"来启动同步。