Options for mariadb-binlog & mysqlbinlog in MariaDB Enterprise Server 23.07

Overview

The mariadb-binlog utility is the newer name for mysqlbinlog, though you can still run it using either name.

Option

Description

--base64-output

Determine when the output statements should be base64-encoded BINLOG statements: 'never' neither prints base64 encodings nor verbose event data, and will exit on error if a row-based event is found. 'decode-rows' decodes row events into commented SQL statements if the --verbose option is also given. 'auto' outputs base64 encoded entries for row-based and format description events. If no option is given at all, the default is 'auto', and is consequently the only option that should be used when row-format events are processed for re-execution.

--binlog-row-event-max-size

The maximum size of a row-based binary log event in bytes. Rows will be grouped into events smaller than this size if possible. This value must be a multiple of 256.

--character-sets-dir

Directory for character set files.

--database (-d)

List entries for just this database (local log only).

--debug-check

Check memory and open file usage at exit .

--debug-info

Print some debug info at exit.

--default-auth

Default authentication client-side plugin to use.

--defaults-extra-file

Read this file after the global files are read.

--defaults-file

Only read default options from the given file #.

--defaults-group-suffix

Additionally read default groups with # appended as a suffix.

--disable-log-bin (-D)

Disable binary log. This is useful, if you enabled --to-last-log and are sending the output to the same MariaDB server. This way you could avoid an endless loop. You would also like to use it when restoring after a crash to avoid duplication of the statements you already have. NOTE: you will need a SUPER privilege to use this option.

--do-domain-ids

A list of positive integers, separated by commas, that form a whitelist of domain ids. Any log event with a GTID that originates from a domain id specified in this list is displayed. Cannot be used with --ignore-domain-ids. When used with --(ignore|do)-server-ids, the result is the intersection between the two datasets.

--do-server-ids

A list of positive integers, separated by commas, that form a whitelist of server ids. Any log event originating from a server id specified in this list is displayed. Cannot be used with --ignore-server-ids. When used with --(ignore|do)-domain-ids, the result is the intersection between the two datasets. Alias for --server-id.

--flashback (-B)

Flashback feature can rollback you committed data to a special time point.

--force-if-open (-F)

Force if binlog was not closed properly. (Defaults to on; use --skip-force-if-open to disable.)

--force-read (-f)

Force reading unknown binlog events.

--gtid-strict-mode

Process binlog according to gtid-strict-mode specification. The start, stop positions are verified to satisfy start < stop comparison condition. Sequence numbers of any gtid domain must comprise monotically growing sequence (Defaults to on; use --skip-gtid-strict-mode to disable.)

--help (-?)

Display this help and exit.

--hexdump (-H)

Augment output with hexadecimal and ASCII event dump.

--host (-h)

Get the binlog from server.

--ignore-domain-ids

A list of positive integers, separated by commas, that form a blacklist of domain ids. Any log event with a GTID that originates from a domain id specified in this list is hidden. Cannot be used with --do-domain-ids. When used with --(ignore|do)-server-ids, the result is the intersection between the two datasets.

--ignore-server-ids

A list of positive integers, separated by commas, that form a blacklist of server ids. Any log event originating from a server id specified in this list is hidden. Cannot be used with --do-server-ids. When used with --(ignore|do)-domain-ids, the result is the intersection between the two datasets.

--local-load (-l)

Prepare local temporary files for LOAD DATA INFILE in the specified directory.

--no-defaults

Don't read default options from any option file.

--offset (-o)

Skip the first N entries.

--open-files-limit

Used to reserve file descriptors for use by this program.

--password (-p)

Password to connect to remote server.

--plugin-dir

Directory for client-side plugins.

--port (-P)

Port number to use for connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306).

--print-defaults

Print the program argument list and exit.

--print-row-count

Print row counts for each row events (Defaults to on; use --skip-print-row-count to disable.)

--print-row-event-positions

Print row event positions (Defaults to on; use --skip-print-row-event-positions to disable.)

--print-table-metadata

Print metadata stored in Table_map_log_event

--protocol

The protocol to use for connection (tcp, socket, pipe).

--raw

Requires -R. Output raw binlog data instead of SQL statements. Output files named after server logs.

--read-from-remote-server (-R)

Read binary logs from a MariaDB server.

--result-file (-r)

Direct output to a given file. With --raw this is a prefix for the file names.

--rewrite-db

Updates to a database with a different name than the original. Example: rewrite-db='from->to'.

--server-id

Extract only binlog entries created by the server having the given id. Alias for --do-server-ids.

--set-charset

Add 'SET NAMES character_set' to the output.

--short-form (-s)

Just show regular queries: no extra info, no row-based events and no row counts. This is mainly for testing only, and should not be used to feed to the MariaDB server. If you want to just suppress base64-output, you can instead use --base64-output=never

--skip-annotate-row-events

Don't print Annotate_rows events stored in the binary log.

--socket (-S)

The socket file to use for connection.

--ssl

Enable SSL for connection (automatically enabled with other flags). (Defaults to on; use --skip-ssl to disable.)

--ssl-ca

CA file in PEM format (check OpenSSL docs, implies --ssl).

--ssl-capath

CA directory (check OpenSSL docs, implies --ssl).

--ssl-cert

X509 cert in PEM format (implies --ssl).

--ssl-cipher

SSL cipher to use (implies --ssl).

--ssl-crl

Certificate revocation list (implies --ssl).

--ssl-crlpath

Certificate revocation list path (implies --ssl).

--ssl-key

X509 key in PEM format (implies --ssl).

--ssl-verify-server-cert

Verify server's "Common Name" in its cert against hostname used when connecting. This option is disabled by default.

--start-datetime

Start reading the binlog at first event having a datetime equal or posterior to the argument; the argument must be a date and time in the local time zone, in any format accepted by the MariaDB server for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 (you should probably use quotes for your shell to set it properly).

--start-position (-j)

Start reading the binlog at this position. Type can either be a positive integer or a GTID list. When using a positive integer, the value only applies to the first binlog passed on the command line. In GTID mode, multiple GTIDs can be passed as a comma separated list, where each must have a unique domain id. The list represents the gtid binlog state that the client (another "replica" server) is aware of. Therefore, each GTID is exclusive; only events after a given sequence number will be printed to allow users to receive events after their current state.

--stop-datetime

Stop reading the binlog at first event having a datetime equal or posterior to the argument; the argument must be a date and time in the local time zone, in any format accepted by the MariaDB server for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 (you should probably use quotes for your shell to set it properly).

--stop-never

Wait for more data from the server instead of stopping at the end of the last log. Implies --to-last-log.

--stop-never-slave-server-id

The slave server_id used for --read-from-remote-server --stop-never.

--stop-position

Stop reading the binlog at this position. Type can either be a positive integer or a GTID list. When using a positive integer, the value only applies to the last binlog passed on the command line. In GTID mode, multiple GTIDs can be passed as a comma separated list, where each must have a unique domain id. Each GTID is inclusive; only events up to the given sequence numbers are printed.

--table (-T)

List entries for just this table (local log only).

--tls-version

TLS protocol version for secure connection.

--to-last-log (-t)

Requires -R. Will not stop at the end of the requested binlog but rather continue printing until the end of the last binlog of the MariaDB server. If you send the output to the same MariaDB server, that may lead to an endless loop.

--user (-u)

Connect to the remote server as username.

--verbose (-v)

Reconstruct SQL statements out of row events. -v -v adds comments on column data types. -v -v -v adds diagnostic warnings about event integrity before program exit.

--verify-binlog-checksum (-c)

Verify binlog event checksums.

--version (-V)

Print version and exit.