主從同步遇到 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位置索引處的問題,不要reset slave;
reset slave會將主從同步的檔案以及位置恢復到初始狀態,一開始沒有資料還好,有資料的話,相當于重新開始同步,可能會出現一些問題;
一般做主從同步,都是要求以后的資料實作主從同步,而對于舊的資料完全可以使用資料庫同步工具先將資料庫同步,完了再進行主從同步;
好了遇到上面的問題,正確做法是:
1.打開主服務器,進入mysql
2.執行flush logs;//這時主服務器會重新創建一個binlog檔案;
3.在主服務上執行show master slave \G;顯示如下:
4.來到從服務器的mysql;
5.stop slave;
6.change master to master_log_file='mysql-bin.000012',master_log_pos=154;//這里的file和pos都是上面主服務器master顯示的,
7.start slave;//這時候就應可以了
8.show slave status \G;//結果如下:
轉載:https://www.cnblogs.com/maodoudou/p/11217202.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/40013.html
標籤:MySQL
