mysqlbinlog
mysqlbinlog [options]filename
This utility formats the display of the binary log for a MySQL server. Customized applications can also use it for monitoring server activities. The path to the log file to format is given as the second argument for the utility. Additional log files may be given either with filesystem wildcards or by listing them individually, separated by spaces.
Here is an alphabetical list of the options, along with a brief explanation of each:
--base64-outputThis option is used to write binary log entries using base-64 encoding. This is used for debugging and should not be used in production. It’s available as of version 5.1.5 of MySQL.
--character-sets-dir=pathThis option specifies the directory containing character sets.
--database=database,
-d databaseThis option displays information regarding only the database given.
--debug[=options],
-# [options]This option logs debugging information, along with various
settings (e.g., 'd:t:o,logname').
--debug-checkThis option writes debugging information to the log when the utility ends. It’s available as of version 5.1.21 of MySQL.
--debug-infoThis option writes debugging information and CPU and memory usage information to the log after the utility ends.
--disable-log-bin,
-DThis option disables binary logging.
--force-read, -fThis option forces the reading of unknown log information.
--hexdump, -HThis option dumps the log in hexadecimal format.
--help, -?This option displays basic help information.
--host=host,
-h hostThis option specifies the hostname or IP address of a remote server containing the log file to format.
--local-load=path,
-l pathThis option specifies the local directory in which temporary
files are to be prepared for LOAD DATA
INFILE statements.
--offset=number,
-o numberThis option skips number entries
at the start of the log file before starting the display.
--open_files_limitThis option sets the maximum number of open files allowed. The default is 64.
--password=password,
-p passwordThis option provides the password to the remote server that is being accessed.
--port=port,
-P portThis option specifies the port to use for connecting to a remote server.
--position=number,
-j numberThis option sets the number of bytes to skip at the
beginning of the log file. It is deprecated; use
--start-position instead.
--protocol=protocolThis option specifies the protocol to use when connecting to
the server. The choices are TCP,
SOCKET, PIPE, and
MEMORY.
--read-from-remote-server,
-RThis option reads the binary log from a remote server
instead of the local machine. You will need to include the
necessary options for connecting to a remote server:
--host, --password, and
--user. You might also need to include
--port, --protocol, and
--socket.
--result-file=filename,
-r filenameThis option redirects the results of the utility to a given file.
--server-id=identifierThis option returns entries from the binary log that were generated by a connection matching the given process identifier number. This option is available as of version 5.1.4 of MySQL.
--set-charset=character_setThis option adds a SET NAMES statement to
the results to indicate the character set used. It is available as
of version 5.1.12 of MySQL.
--skip-write-binlogThis option disables the --write-binlog
option, which is enabled by default. Otherwise, ANALYZE
TABLE, OPTIMIZE TABLE, and
REPAIR TABLE statements executed by the utility
will be written to the binary log. It’s available as of version
5.1.18 of MySQL.
--short-form, -sThis option changes the output to a shorter format.
--socket=filename,
-S filenameThis option provides the name of the server’s socket file for Unix systems, piped name for Windows systems.
--start-datetime=datetimeThis option begins reading the log from the first event
recorded with a date and time equal to or greater than the one
given. The time can be in DATETIME or
TIMESTAMP format. Use the time zone of the
server.
--start-position=numberThis option sets the position to start reading the log file.
--stop-datetime=datetimeThis option instructs the utility to stop reading the log at
the first event recorded with a date and time equal to or greater
than the one given. The time can be in DATETIME
or TIMESTAMP format. Use the time zone of the
server.
--stop-position=numberThis option sets the position to stop reading the log file.
--table=table,
-t tableThis option obtains information on the table named.
--to-last-log, -tThis option instructs the utility to continue on in sequence reading through all binary logs, starting with the one given until the last log file is processed.
--user=user,
-u userThis option specifies the username to use when connecting to a remote server.
--version, -VThis option displays the version of the utility.
--write-binlogWith this option, ANALYZE TABLE,
OPTIMIZE TABLE, and REPAIR
TABLE statements executed by the utility will be written
to the binary log. It’s available as of version 5.1.18 of MySQL
and is enabled by default. To disable it, use
--skip-write-binlog.