mysqlbinlog:Utility for Processing Binary Log Files
The binary log files that the server generates are written in binary format. To examine these files in text format, use the mysqlbinlog utility.
Invoke mysqlbinlog like this:shell> mysqlbinlog [options] log-file ...
For example, to display the contents of the binary log binlog.000003, use this command:shell> mysqlbinlog binlog.0000003
The output includes all statements contained in binlog.000003, together with other information such as the time each statement took, the thread ID of the client that issued it, the timestamp when it was issued, and so forth.
Normally, you use mysqlbinlog to read binary log files directly and apply them to the local MySQL server. It is also possible to read binary logs from a remote server by using the --read-from-remote-server option.
When you read remote binary logs, the connection parameter options can be given to indicate how to connect to the server, but they are ignored unless you also specify the --read-from-remote-server option. These options are --host, --password, --port, --protocol, --socket, and --user.
You can also use mysqlbinlog to read relay log files written by a slave server in a replication setup. Relay logs have the same format as binary log files.
The binary log is discussed further in Section 5.11.3, “The Binary Log”.
mysqlbinlog supports the following options:
--help, -?
Display a help message and exit.
--database=db_name, -d db_name
List entries for just this database (local log only).
--force-read, -f
With this option, if mysqlbinlog reads a binary log event that it does not recognize, it prints a warning, ignores the event, and continues. Without this option, mysqlbinlog stops if it reads such an event.
--hexdump, -H
Display a hex dump of the log in comments. This output can be helpful for repl