mysqlbinlog備份時候報錯Sanity check failed

  • 2019 年 10 月 5 日
  • 筆記

今天在複習mysql的二進位日誌時候,發現出了點問題,如下:

mysqlbinlog -uroot -proot /usr/local/mysql/data/node1.000004 --start-datetime="2016-05-04 13:30:00" --stop-datetime="2016-05-04 13:45:00" > a.sql

ERROR: Error in Log_event::read_log_event(): 'Sanity check failed', data_len: 171, event_type: 30

ERROR: Could not read entry at offset 1009: Error in log format or read error.

查了下網上的說明,說是當前環境變數下的mysqlbinlog的版本和當前MySQL的版本不一樣導致的。只要加全局路徑即可。【說明:我以前在這台虛擬機上安裝過MariaDB10.0.12,後來換成了MySQL5.6】

如下:

/usr/loca/mysql/bin/mysqlbinlog -uroot -proot /usr/local/mysql/data/node1.000004 --start-datetime="2016-05-04 13:30:00" --stop-datetime="2016-05-04 13:45:00" > a.sql

這樣就能正確的執行備份了。