0

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

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
user984003
  • 28,050
  • 64
  • 189
  • 285

1 Answers1

1

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.

Bill Karwin
  • 538,548
  • 86
  • 673
  • 828
  • But are you sure it's even necessary? The --flush-logs parameter should have started a new binlog, and MySQL's backup/recovery directions don't mention needing to use this info. It just seemed odd to me that it was there, then. – user984003 Apr 10 '19 at 14:14