Mysql同步出错解决方法
一、主从不同步
mysql> show slave status;
报错:Error xxx dosn't exist
且show slave status\G:
Slave_SQL_Running: NO
Seconds_Behind_Master: NULL
解决办法一
1、首先停掉Slave服务:
mysql> SLAVE STOP;
2、到主服务器上查看主机状态:记录File和Position对应的值:
mysql> SHOW MASTER STATUS;
+------------------+-----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+-----------+--------------+------------------+
| updatelog.000001 | 215 +------------------+-----------+--------------+------------------+ 3、到slave服务器上执行手动同步:
mysql> CHANGE MASTER TO
-> MASTER_HOST='master_host_name',
-> MASTER_USER='replication_user_name',
-> MASTER_PASSWORD='replication_password',
-> MASTER_PORT=3306
-> MASTER_LOG_FILE='recorded_log_file_name',
-> MASTER_LOG_POS=recorded_log_position;
mysql> SLAVE START;
// 再次查看slave状态发现: