LinuxCommandLibrary

mysqlbinlog

displays MySQL binary log contents in readable format

TLDR

Read binary log

$ mysqlbinlog [mysql-bin.000001]
copy
Read from specific position
$ mysqlbinlog --start-position=[4] [mysql-bin.000001]
copy
Read events in time range
$ mysqlbinlog --start-datetime="[2024-01-01 00:00:00]" --stop-datetime="[2024-01-02 00:00:00]" [mysql-bin.000001]
copy
Output specific database only
$ mysqlbinlog --database=[mydb] [mysql-bin.000001]
copy

SYNOPSIS

mysqlbinlog [options] logfile_...

DESCRIPTION

mysqlbinlog displays MySQL binary log contents in readable format. Used for point-in-time recovery, replication debugging, and audit purposes. Converts binary events to SQL statements.

PARAMETERS

--start-position pos

Start reading from position.
--stop-position pos
Stop reading at position.
--start-datetime datetime
Start time filter.
--stop-datetime datetime
Stop time filter.
--database db
Show only database events.
--result-file file
Output to file.
--base64-output mode
Base64 output mode.

SEE ALSO

mysql(1), mysqldump(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community