5.9.3. Point-in-Time Recovery
If a MySQL server was started with the
--log-bin
option to enable binary logging, you
can use the mysqlbinlog utility to recover
data from the binary log files, starting from a specified point
in time (for example, since your last backup) until the present
or another specified point in time. For information on enabling
the binary log and using mysqlbinlog, see
Section 5.11.4, “The Binary Log”, and Section 8.8, “mysqlbinlog — Utility for Processing Binary Log Files”.
To restore data from a binary log, you must know the location
and name of the current binary log file. By default, the server
creates binary log files in the data directory, but a pathname
can be specified with the --log-bin
option to
place the files in a different location. Typically the option is
given in an option file (that is, my.cnf
or
my.ini
, depending on your system). It can
also be given on the command line when the server is started. To
determine the name of the current binary log file, issue the
following statement:
mysql> SHOW BINLOG EVENTS\G
If you prefer, you can execute the following command from the
command line instead:
shell> mysql -u root -p -E -e "SHOW BINLOG EVENTS"
Enter the root
password for your server when
mysql prompts you for it.