資料庫版本:5.6.16
測試環境MySQL 主從,資料庫被人重啟,忘記開啟start slave,導致主從失效,停了一天的資料沒有追上。
檢視從庫的資料庫狀態:
show slave status\G
提示Client requested master to start replication from position > file size; 還有最後一次執行的日誌點,26519749,二進位制日誌位置mysql-bin.000002
解決辦法:
在主庫的日誌目錄下,執行:
mysqlbinlog mysql-bin.000002 > yoon.log
tail -f yoon.log
#150928 16:58:18 server id 578 end_log_pos 26423110 CRC32 0x57ea8c95 Xid = 4675985
end_log_pos 26423110 比 報錯提示的26519749小很多,直接從這個點開始重新配置主從
在從庫
change master to master_host='172.168.3.78',master_port=3306,master_user='master',master_password='master',master_log_file='mysql-bin.000002',master_log_pos=26423110;
檢視從庫狀態,主從OK,等著追上來~~~~