0
votes

I have a system where I have binary-logging enabled and I perform a mysqldump (single-transaction, all InnoDB) nightly. If I wanted to perform a point-in-time recovery, how would I know at which point in the binary log to start rolling forward? For example.

bin-log.000001 contains all the change before, and after my dump.sql file. If I do:

mysql < dump.sql

To restore to the last full export and then roll forward to the latest point using:

mysqlbinlog bin-log.000001 | mysql

Will MySQL know the right place to start from?

2

2 Answers

1
votes

So yeah, a bit more research has led me here. Just in case anyone else was wondering.

0
votes

See the usage of mysqlbinlog:

  --stop-datetime=name
                      Stop reading the binlog at first event having a datetime
                      equal or posterior to the argument; the argument must be
                      a date and time in the local time zone, in any format
                      accepted by the MySQL server for DATETIME and TIMESTAMP
                      types, for example: 2004-12-25 11:25:56 (you should
                      probably use quotes for your shell to set it properly).

Seems to do exactly what you want.