简体   繁体   中英

MySQL recovery, include binlog position MASTER_LOG_POS

I run a MySQL DB dump like this:

mysqldump mydatabase -u root -p --single-transaction --events --routines --quick --master-data=2 --flush-logs --flush-privileges > mydump.sql

This creates a dump file, which contains the following line:

CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000008', MASTER_LOG_POS=120;

This tells me that any new changes are recorded starting in mysql-bin.000008

I can then, after loading my dump file, load the incremental files like this (assuming mysql-bin.000009 was also created at some point):

mysqlbinlog mysql-bin.000008 mysql-bin.000009 | mysql -u root -p mydatabase

But what about MASTER_LOG_POS = 120? Do I need to include that and, if so, how? My dump command included --flush-logs so it should have started a brand new file.

I'm reading the here https://dev.mysql.com/doc/refman/5.7/en/backup-policy.html and here https://dev.mysql.com/doc/refman/5.7/en/recovery-from-backups.html

https://dev.mysql.com/doc/refman/5.6/en/mysqlbinlog.html#option_mysqlbinlog_start-position says:

--start-position=N, -j N

Start reading the binary log at the first event having a position equal to or greater than N. This option applies to the first log file named on the command line.

This option is useful for point-in-time recovery.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM