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.2.4, “The Binary Log”, and
Section 4.6.7, “mysqlbinlog — Utility for Processing Binary Log Files”.
MySQL Enterprise. For maximum data recovery, the MySQL Enterprise Monitor advises subscribers to synchronize to disk at each write. For more information, see http://www.mysql.com/products/enterprise/advisors.html.
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 path name
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 MASTER STATUS
If you prefer, you can execute the following command from the command line instead:
shell> mysql -u root -p -E -e "SHOW MASTER STATUS"
Enter the root
password for your server when
mysql prompts you for it.
To view the contents of a binary log, use
mysqlbinlog
. See Section 4.6.7, “mysqlbinlog — Utility for Processing Binary Log Files”.
User Comments
Add your own comment.