MySQL主从备份报错分析

1. ERROR 2003(HY000): Can't connect to MySQL server on 'localhost' (113)

检查防火墙配置:
添加3306端口:
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
查看已添加端口:
firewall-cmd --list-ports
【MySQL主从备份报错分析】2. 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; "来启动同步。



    推荐阅读