Explore logging tools for MariaDB Server. This section introduces utilities and methods for managing and analyzing server logs, crucial for monitoring activity and troubleshooting issues.
Use mariadb-binlog to process binary log files. This utility is essential for examining replication events, recovering from data loss, and auditing changes in your MariaDB Server.
mysqlbinlog is a client tool which is called mariadb-binlog now. It can still be accessed under its original name via a symlink in Linux, or an alternate binary in Windows.
This page is licensed: CC BY-SA / Gnu FDL
The MariaDB server's binary log is a set of files containing "events" which represent modifications to the contents of a MariaDB database.
Events are written in a binary (that is, non-human-readable) format. The mariadb-binlog utility is used to view these events in plain text.
Run from a command line:
See for details on the available options.
Display the contents of a file named mariadb-bin.000152 like this:
The logging format is determined by the value of the system variable. If you are using statement-based logging, the output includes the SQL statement, the ID of the server the statement was executed on, a timestamp, and how much time the statement took to execute. If you are using row-based logging, the output of an event will not include an SQL statement, but will instead output how individual rows were changed.
The output from mariadb-binlog can be used as input to the mariadb client to redo the statements contained in a . This is useful for recovering after a server crash (replace binlog-filename with the name of a binary log file):
If you would like to view and possibly edit the file before applying it to your database, use the -r flag to redirect the output to a file (replace outputfile with the name of a file to store the output, and binlog-filename with the name of a binary log file):
In the output file, delete any statements you don't want executed (such as an accidental DROP DATABASE). Once you are satisfied with the contents, you can execute it:
Be careful to process multiple log files in a single connection, especially if one or more of them have any CREATE TEMPORARY TABLE ... statements. Temporary tables are dropped when the mariadb client terminates, so if you are processing multiple log files one at a time (i.e. multiple connections), and one log file creates a temporary table and then a subsequent log file refers to the table, you get an 'unknown table' error.
To execute multiple log files using a single connection, list them all on the mariadb-binlog command line:
If you need to manually edit the binlogs before executing them, combine them all into a single file before processing:
mariadb-binlog [options] binlog-filename [binlog-filename ...]mariadb-binlog mariadb-bin.000152mariadb-binlog binlog-filename | mysql -u root -pmariadb-binlog -r outputfile binlog-filenamemariadb -u root -p --binary-mode < outputfilenamemariadb-binlog mariadb-bin.000001 mariadb-bin.000002 | mariadb -u root -p --binary-modemariadb-binlog mariadb-bin.000001 > /tmp/mariadb-bin.sql
mariadb-binlog mariadb-bin.000002 >> /tmp/mariadb-bin.sql
# make any edits
mariadb -u root -p -e "source /tmp/mariadb-bin.sql"mariadb-dumpslow is a tool to examine the slow query log.
It parses the slow query log files, printing a summary result. Normally, mariadb-dumpslow groups queries that are similar, except for the particular values of number and string data values. It “abstracts” these values to N and ´S´ when displaying summary output. The -a and -n options can be used to modify value abstracting behavior.
-aDon't abstract all numbers to N and strings to 'S'.
-d, --debugDebug mode.
-g patternGrep: only consider statements that include this string pattern.
--helpDisplay help.
-h hostnameHostname of db server for -slow.log filename (can be a wildcard). The Default is '', that is, match all hosts.
-i nameName of server instance (if using mysql.server startup script).
-lDon't subtract lock time from total time.
-j, --jsonStores the dumped data in JSON format. Available from MariaDB 12.1.
-n numberAbstract numbers with at least this number of digits within names.
-rReverse the sort order (largest last instead of first).
-s orderWhat to sort by (aa, ae, al, ar, at, a, c, e, l, r, t). The default is at . The meaning of the abbreviations is:
aa – average rows affected
ae – aggregated number of rows examined
al – average lock time
-t numberJust show the top number of queries.
-v, --verboseVerbose mode.
This page is licensed: CC BY-SA / Gnu FDL
ar – average rows sentat – average query time
a – rows affected
c – count
e – rows examined
l – lock time
r – rows sent
t – query time:
mariadb-dumpslow [ options... ] [ logs... ]Annotate_rows events accompany row events and describe the query which caused the row event.
In the , each Annotate_rows event precedes the corresponding Table map event or the first of the Table map events, if there are more than one (for instance, in a case of multi-delete or insert delayed).
The following options control the behavior ofAnnotate_rows_log_event.
--binlog-annotate-row-eventsThis option tells the master to write Annotate_rows events to the binary log. See for a detailed description of the variable.
Session values allow to annotate only some selected statements:
--replicate-annotate-row-eventsThis option tells the replica to reproduce Annotate_row events received from the master in its own binary log (sensible only when used in tandem with the log-slave-updates option).
See for a detailed description of the variable.
--skip-annotate-row-eventsThis option tells to skip all Annotate_row events in its output (by default, mariadb-binlog prints Annotate_row events, if the binary log contains them).
This page is licensed: CC BY-SA / Gnu FDL
master> DROP DATABASE IF EXISTS test;
master> CREATE DATABASE test;
master> USE test;
master> CREATE TABLE t1(a int);
master> INSERT INTO t1 VALUES (1), (2), (3);
master> CREATE TABLE t2(a int);
master> INSERT INTO t2 VALUES (1), (2), (3);
master> CREATE TABLE t3(a int);
master> INSERT DELAYED INTO t3 VALUES (1), (2), (3);
master> DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3
-> WHERE t1.a=t2.a AND t2.a=t3.a;
master> SHOW BINLOG EVENTS IN 'master-bin.000001';
+-------------------+------+---------------+-----------+-------------+---------------------------------------------------------------------------------+
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
+-------------------+------+---------------+-----------+-------------+---------------------------------------------------------------------------------+
| master-bin.000001 | 4 | Format_desc | 100 | 240 | Server ver: 5.5.20-MariaDB-mariadb1~oneiric-log, Binlog ver: 4 |
| master-bin.000001 | 240 | Query | 100 | 331 | DROP DATABASE IF EXISTS test |
| master-bin.000001 | 331 | Query | 100 | 414 | CREATE DATABASE test |
| master-bin.000001 | 414 | Query | 100 | 499 | use `test`; CREATE TABLE t1(a int) |
| master-bin.000001 | 499 | Query | 100 | 567 | BEGIN |
| master-bin.000001 | 567 | Annotate_rows | 100 | 621 | INSERT INTO t1 VALUES (1), (2), (3) |
| master-bin.000001 | 621 | Table_map | 100 | 662 | table_id: 16 (test.t1) |
| master-bin.000001 | 662 | Write_rows | 100 | 706 | table_id: 16 flags: STMT_END_F |
| master-bin.000001 | 706 | Query | 100 | 775 | COMMIT |
| master-bin.000001 | 775 | Query | 100 | 860 | use `test`; CREATE TABLE t2(a int) |
| master-bin.000001 | 860 | Query | 100 | 928 | BEGIN |
| master-bin.000001 | 928 | Annotate_rows | 100 | 982 | INSERT INTO t2 VALUES (1), (2), (3) |
| master-bin.000001 | 982 | Table_map | 100 | 1023 | table_id: 17 (test.t2) |
| master-bin.000001 | 1023 | Write_rows | 100 | 1067 | table_id: 17 flags: STMT_END_F |
| master-bin.000001 | 1067 | Query | 100 | 1136 | COMMIT |
| master-bin.000001 | 1136 | Query | 100 | 1221 | use `test`; CREATE TABLE t3(a int) |
| master-bin.000001 | 1221 | Query | 100 | 1289 | BEGIN |
| master-bin.000001 | 1289 | Annotate_rows | 100 | 1351 | INSERT DELAYED INTO t3 VALUES (1), (2), (3) |
| master-bin.000001 | 1351 | Table_map | 100 | 1392 | table_id: 18 (test.t3) |
| master-bin.000001 | 1392 | Write_rows | 100 | 1426 | table_id: 18 flags: STMT_END_F |
| master-bin.000001 | 1426 | Table_map | 100 | 1467 | table_id: 18 (test.t3) |
| master-bin.000001 | 1467 | Write_rows | 100 | 1506 | table_id: 18 flags: STMT_END_F |
| master-bin.000001 | 1506 | Query | 100 | 1575 | COMMIT |
| master-bin.000001 | 1575 | Query | 100 | 1643 | BEGIN |
| master-bin.000001 | 1643 | Annotate_rows | 100 | 1748 | DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a |
| master-bin.000001 | 1748 | Table_map | 100 | 1789 | table_id: 16 (test.t1) |
| master-bin.000001 | 1789 | Table_map | 100 | 1830 | table_id: 17 (test.t2) |
| master-bin.000001 | 1830 | Delete_rows | 100 | 1874 | table_id: 16 |
| master-bin.000001 | 1874 | Delete_rows | 100 | 1918 | table_id: 17 flags: STMT_END_F |
| master-bin.000001 | 1918 | Query | 100 | 1987 | COMMIT |
+-------------------+------+---------------+-----------+-------------+---------------------------------------------------------------------------------+...
SET SESSION binlog_annotate_row_events=ON;
... statements to be annotated ...
SET SESSION binlog_annotate_row_events=OFF;
... statements not to be annotated ......> mariadb-binlog.exe -vv -R --user=root --port=3306 --host=localhost master-bin.000001
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#100516 15:36:00 server id 100 end_log_pos 240 Start: binlog v 4, server v 5.1.44-debug-log created 100516
15:36:00 at startup
ROLLBACK/*!*/;
BINLOG '
oNjvSw9kAAAA7AAAAPAAAAAAAAQANS4xLjQ0LWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACg2O9LEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAA=
'/*!*/;
# at 240
#100516 15:36:18 server id 100 end_log_pos 331 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
SET @@session.pseudo_thread_id=1/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1
/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
DROP DATABASE IF EXISTS test
/*!*/;
# at 331
#100516 15:36:18 server id 100 end_log_pos 414 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
CREATE DATABASE test
/*!*/;
# at 414
#100516 15:36:18 server id 100 end_log_pos 499 Query thread_id=1 exec_time=0 error_code=0
use test/*!*/;
SET TIMESTAMP=1274009778/*!*/;
CREATE TABLE t1(a int)
/*!*/;
# at 499
#100516 15:36:18 server id 100 end_log_pos 567 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
BEGIN
/*!*/;
# at 567
# at 621
# at 662
#100516 15:36:18 server id 100 end_log_pos 621 Annotate_rows:
#Q> INSERT INTO t1 VALUES (1), (2), (3)
#100516 15:36:18 server id 100 end_log_pos 662 Table_map: `test`.`t1` mapped to number 16
#100516 15:36:18 server id 100 end_log_pos 706 Write_rows: table id 16 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAAJYCAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
stjvSxdkAAAALAAAAMICAAAQABAAAAAAAAEAAf/+AQAAAP4CAAAA/gMAAAA=
'/*!*/;
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t1
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t1
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at 706
#100516 15:36:18 server id 100 end_log_pos 775 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
COMMIT
/*!*/;
# at 775
#100516 15:36:18 server id 100 end_log_pos 860 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
CREATE TABLE t2(a int)
/*!*/;
# at 860
#100516 15:36:18 server id 100 end_log_pos 928 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
BEGIN
/*!*/;
# at 928
# at 982
# at 1023
#100516 15:36:18 server id 100 end_log_pos 982 Annotate_rows:
#Q> INSERT INTO t2 VALUES (1), (2), (3)
#100516 15:36:18 server id 100 end_log_pos 1023 Table_map: `test`.`t2` mapped to number 17
#100516 15:36:18 server id 100 end_log_pos 1067 Write_rows: table id 17 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAAP8DAAAAABEAAAAAAAAABHRlc3QAAnQyAAEDAAE=
stjvSxdkAAAALAAAACsEAAAQABEAAAAAAAEAAf/+AQAAAP4CAAAA/gMAAAA=
'/*!*/;
### INSERT INTO test.t2
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t2
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t2
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at 1067
#100516 15:36:18 server id 100 end_log_pos 1136 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
COMMIT
/*!*/;
# at 1136
#100516 15:36:18 server id 100 end_log_pos 1221 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
CREATE TABLE t3(a int)
/*!*/;
# at 1221
#100516 15:36:18 server id 100 end_log_pos 1289 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
BEGIN
/*!*/;
# at 1289
# at 1351
# at 1392
#100516 15:36:18 server id 100 end_log_pos 1351 Annotate_rows:
#Q> INSERT DELAYED INTO t3 VALUES (1), (2), (3)
#100516 15:36:18 server id 100 end_log_pos 1392 Table_map: `test`.`t3` mapped to number 18
#100516 15:36:18 server id 100 end_log_pos 1426 Write_rows: table id 18 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAAHAFAAAAABIAAAAAAAAABHRlc3QAAnQzAAEDAAE=
stjvSxdkAAAAIgAAAJIFAAAQABIAAAAAAAEAAf/+AQAAAA==
'/*!*/;
### INSERT INTO test.t3
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at 1426
# at 1467
#100516 15:36:18 server id 100 end_log_pos 1467 Table_map: `test`.`t3` mapped to number 18
#100516 15:36:18 server id 100 end_log_pos 1506 Write_rows: table id 18 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAALsFAAAAABIAAAAAAAAABHRlc3QAAnQzAAEDAAE=
stjvSxdkAAAAJwAAAOIFAAAQABIAAAAAAAEAAf/+AgAAAP4DAAAA
'/*!*/;
### INSERT INTO test.t3
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t3
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at 1506
#100516 15:36:18 server id 100 end_log_pos 1575 Query thread_id=2 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
COMMIT
/*!*/;
# at 1575
#100516 15:36:18 server id 100 end_log_pos 1643 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
BEGIN
/*!*/;
# at 1643
# at 1748
# at 1789
# at 1830
# at 1874
#100516 15:36:18 server id 100 end_log_pos 1748 Annotate_rows:
#Q> DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3
#Q> WHERE t1.a=t2.a AND t2.a=t3.
#100516 15:36:18 server id 100 end_log_pos 1789 Table_map: `test`.`t1` mapped to number 16
#100516 15:36:18 server id 100 end_log_pos 1830 Table_map: `test`.`t2` mapped to number 17
#100516 15:36:18 server id 100 end_log_pos 1874 Delete_rows: table id 16
#100516 15:36:18 server id 100 end_log_pos 1918 Delete_rows: table id 17 flags: STMT_END_F
BINLOG '
stjvSxNkAAAAKQAAAP0GAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
stjvSxNkAAAAKQAAACYHAAAAABEAAAAAAAAABHRlc3QAAnQyAAEDAAE=
stjvSxlkAAAALAAAAFIHAAAAABAAAAAAAAAAAf/+AQAAAP4CAAAA/gMAAAA=
### DELETE FROM test.t1
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### DELETE FROM test.t1
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### DELETE FROM test.t1
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
stjvSxlkAAAALAAAAH4HAAAQABEAAAAAAAEAAf/+AQAAAP4CAAAA/gMAAAA=
'/*!*/;
### DELETE FROM test.t2
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### DELETE FROM test.t2
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### DELETE FROM test.t2
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at 1918
#100516 15:36:18 server id 100 end_log_pos 1987 Query thread_id=1 exec_time=0 error_code=0
SET TIMESTAMP=1274009778/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mariadb-binlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;This page is licensed: GPLv2, originally from fill_help_tables.sql
mariadb-binlog is a utility included with MariaDB for processing binary log and relay log files.
The following options are supported by . They can be specified on the command line or in option files.
Display a help statement.
--base64-output=name
Determine when the output statements should be base64-encoded BINLOG statements. Options (case-insensitive) include auto, unspec, never ,and decode-rows. never neither prints base64 encodings nor verbose event data, and exits on error if a is found. This option is useful for binlogs that are entirely statement-based. decode-rows decodes row events into commented SQL statements if the --verbose option is also given. It can enhance the debugging experience with large binary log files, as the raw data is omitted. Unlike never, mariadb-binlog does not exit with an error if a row event is found. auto
Default value: auto.
The maximum size in bytes of a row-based event. Should be a multiple of 256. Minimum 256, maximum 18446744073709547520. Default value: 4294967040 (4GB)
Directory where the are.
Output entries from the binary log (local log only) that occur while the name has been selected as the default database by . Only one database can be specified. The effects depend on whether the is in use. For statement-based logging, the server only logs statements where the default database is name. The default database is set with the statement. For row-based logging, the server logs any updates to any tables in the named database, irrespective of the current database. Ignored in --raw mode.
In a debug build, write a debugging log. A typical debug options string is d:t:o,file\_name. Default value: d:t:o,/tmp/mariadb-binlog.trace
Print some debug info at exit. Default value: FALSE
Print some debug info and memory and CPU info at exit. Default value: FALSE
Default authentication client-side plugin to use.
Read the file name, which can be the full path or the path relative to the current directory, after the global files are read.
Only read default options from the given file name, which can be the full path or the path relative to the current directory.
Also read groups with a suffix of str. For example, since mariadb-binlog normally reads the [client] and [mysqlbinlog] groups, --defaults-group-suffix=x would cause it to also read the groups \[mysqlbinlog\_x] and \[client\_x].
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. The SUPER privilege is needed to use this option. Default value: FALSE
A list of positive integers, separated by commas, that form a whitelist of domain ids. Any log event with a that originates from a domain id specified in this list is displayed. Cannot be used with --ignore-domain-ids. When used with --ignore-server-ids or --do-server-ids, the result is the intersection between the two datasets. Available from MariaDB 10.9.
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-domain-ids or do-domain-ids, the result is the intersection between the two datasets. Alias for --server-id. Available from MariaDB 10.9.
Support mode. Default value: FALSE
Force if binlog was not closed properly. Defaults to ON; use --skip-force-if-open to disable. Default value: TRUE
If mariadb-binlog reads a binary log event that it does not recognize, it prints a warning, ignores the event, and continues. Without this option, mariadb-binlog stops if it reads such an event. Default value: FALSE
Process binlog according to gtid-strict-mode specification. The start, stop positions are verified to satisfy the start < stop comparison condition. Sequence numbers of any domain must comprise a monotonically growing sequence. Defaults to ON; use --skip-gtid-strict-mode to disable. Available from MariaDB 10.8. Default value: TRUE
Augment output with hexadecimal and ASCII event dump. Default value: FALSE
Get the binlog from the MariaDB server on the given host.
A list of positive integers, separated by commas, that form a blacklist of domain ids. Any log event with a that originates from a domain id specified in this list is hidden. Cannot be used with --do-domain-ids. When used with --ignore-server-ids or --do-server-ids, the result is the intersection between the two datasets. Available from MariaDB 10.9.
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-domain-ids or --do-domain-ids, the result is the intersection between the two datasets. Available from MariaDB 10.9.
Prepare local temporary files for in the specified directory. The temporary files are not automatically removed.
Don't read default options from any option file.
Skip the first value entries in the log. Default value: 0
Reserve file descriptors for usage by mariadb-binlog. Default value: 64
Password to connect to the remote server. The password can be omitted, allow it to be entered from the prompt, or an option file can be used to avoid the security risk of passing a password on the command line.
Directory for client-side plugins.
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). Default value: 0
Removed. Use --start-position instead.
Print the program argument list from all option files and exit.
Print row counts for each row of events. (Defaults to ON; use --skip-print-row-count to disable.) Default value: TRUE
Print row event positions. Defaults to on; use --skip-print-row-event-positions to disable.) Default value: TRUE
Print metadata stored in Table_map_log_event.
The protocol of the connection (tcp, socket, pipe, memory).
Requires -R. Output raw binlog data instead of SQL statements. Output files are named after server logs.
Read binary logs from a remote MariaDB server rather than reading a local log file. Any connection parameter options are ignored unless this option is given as well. These options are --host, --password, --port, --protocol, --socket, and --user. This option requires that the remote server be running. It works only for binary log files on the remote server, not relay log files. Default value: FALSE
Direct output to a given file. With --raw, this is a prefix for the file names.
Updates to a database with a different name than the original. Example: rewrite-db='from->to'. For events that are logged as statements, rewriting the database constitutes changing a statement's default database from db1 to db2. There is no statement analysis or rewrite of any kind; that is, if you specify db1.tbl in the statement explicitly, that occurrence won't be changed to db2.tbl. Row-based events are rewritten correctly to use the new database name. Filtering (for instance, with --database=name) happens before the database rewrites have been performed. If you use this option on the command line and > has a special meaning to your command interpreter, quote the value (for instance, --rewrite-db="oldname->newname").
Extract only binlog entries created by the server having the given id. From MariaDB 10.9, an alias for --do-server-ids. Default value: 0
Add SET NAMES character_set to the output to specify the to be used for processing log files.
Shared-memory name to use for Windows connections using shared memory to a local server (started with the --shared-memory option). Case-sensitive. Default value: MYSQL
Just show regular queries: no extra info and no row-based events. This is for testing only, and should not be used in production systems. If you want to suppress base64-output, consider using --base64-output=never instead. Default value: FALSE
Skip all events in the mariadb-binlog output (by default, mariadb-binlog prints Annotate_rows events if the binary log contains them).
For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.
Enables . TLS is also enabled even without setting this option when certain other TLS options are set. The --ssl option does not enable by default. In order to verify the server certificate, you must specify the --ssl-verify-server-cert option. Default value: FALSE
Defines a path to a PEM file that should contain one or more X509 certificates for trusted Certificate Authorities (CAs) to use for . This option requires that you use the absolute path, not a relative path. See for more information. This option implies the --ssl option.
Defines a path to a directory that contains one or more PEM files that should each contain one X509 certificate for a trusted Certificate Authority (CA) to use for . This option requires that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the command. See for more information. This option is only supported if the client was built with OpenSSL or yaSSL. If the client was built with GnuTLS or Schannel, then this option is not supported. See for more information about which libraries are used on which platforms. This option implies the --ssl option.
Defines a path to the X509 certificate file to use for . This option requires that you use the absolute path, not a relative path. This option implies the --ssl option.
List of permitted ciphers or cipher suites to use for . This option implies the --ssl option.
Defines a path to a PEM file that should contain one or more revoked X509 certificates to use for . This option requires that you use the absolute path, not a relative path. See for more information. This option is only supported if the client was built with OpenSSL or Schannel. If the client was built with yaSSL or GnuTLS, then this option is not supported. See for more information about which libraries are used on which platforms.
Defines a path to a directory that contains one or more PEM files that should each contain one revoked X509 certificate to use for . This option requires that you use the absolute path, not a relative path. The directory specified by this option needs to be run through the command. See for more information. This option is only supported if the client was built with OpenSSL. If the client was built with yaSSL, GnuTLS, or Schannel, then this option is not supported. See for more information about which libraries are used on which platforms.
Defines a path to a private key file to use for . This option requires that you use the absolute path, not a relative path. This option implies the --ssl option.
Enables . This option is disabled by default. Default value: FALSE
If specified, start reading the binlog at the first event having a datetime equal to or later than the argument; the argument must be a date and time in the local time zone, in any format accepted by the MariaDB server for and types, for example: 2014-12-25 11:25:56 (you should probably use quotes for your shell to set it properly). This option is useful for point-in-time recovery.
Start reading the binlog at this position. Type can either be a positive integer or, from MariaDB 10.8, a 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 are printed to allow users to receive events after their current state. Default value: 4
Options --start-position and --stop-position currently compare Sequence Numbers only per Domain ID and ignore Server IDs. This is incorrect, as it is different from the Replication design for GTIDs, which compares per Domain–Server ID pair. MDEV-37231 tracks this bug.
If specified, stop reading the binlog at the first event having a datetime equal to 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: 2014-12-25 11:25:56 (you should probably use quotes for your shell to set it properly). Ignored in --raw mode.
Emit a warning if the specified time is not found within the specified binlogs.
Wait for more data from the server (and thus requires -R or --read-from-remote-server) instead of stopping at the end of the last log. Implies --to-last-log.
The replica used for --read-from-remote-server --stop-never.
If specified, stop reading the binlog at this position. Type can either be a positive integer or, from MariaDB 10.8, a 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. Ignored in --raw mode.
Emit a warning if the specified position or GTID is not within the specified binlogs.
Emit a warning if the specified position is beyond the end of the last binlog.
Options --start-position and --stop-position currently compare Sequence Numbers only per Domain ID and ignore Server IDs. This is incorrect, as it is different from the Replication design for GTIDs, which compares per Domain–Server ID pair. MDEV-37231 tracks this bug.
List entries for just this table (affects only row events).
This option accepts a comma-separated list of TLS protocol versions. A TLS protocol version will only be enabled if it is present in this list. All other TLS protocol versions will not be permitted. See for more information. Default value: TLSv1.1,TLSv1.2,TLSv1.3
Requires -R or --read-from-remote-server. Does not stop at the end of the requested binlog but rather continues 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. Default value: FALSE
Connect to the remote server as username.
Reconstruct SQL statements out of row events. -v -v adds comments on column data types.
Print version and exit.
Verify when reading a binlog file.
In addition to reading options from the command line, mariadb-binlog can also read options from . If an unknown option is provided to mariadb-binlog in an option file, it is ignored.
The following options relate to how MariaDB command line tools handle option files. They must be given as the first argument on the command line:
mariadb-binlog is linked with . However, MariaDB Connector/C does not handle the parsing of option files for this client. That is performed by the server's option file parsing code. See for more information.
mariadb-binlog reads options from the following from the :
This page is licensed: CC BY-SA / Gnu FDL
unspecROW-format events are processed for re-executing on the MariaDB server. This behavior is presumed, such that auto is the default value when no option specification is provided. The other option values are intended only for debugging or testing purposes because they may produce output that does not include all events in executable form.--base64-output[=name]
Determine when the output statements should be base64-encoded BINLOG statements. Options (case-insensitive) include auto, unspec, always (deprecated), never , and decode-rows. never disables it and works only for binlogs without row-based events; decode-rows decodes row events into commented SQL statements if the --verbose option is also given. Unlike never, mariadb-binlog does not exit with an error if a row event is found auto or unspec, the default, prints base64 only when necessary (for instance, for and format description events), and is the only safe behavior if you intend to use the output of mariadb-binlog to re-execute binary log file contents. The other option values are intended only for debugging or testing purposes, because they may produce output that does not include all events in executable form. always prints base64 whenever possible, and is for debugging only and should not be used in a production system. If this option is not given, the default is auto; if it is given with no argument, always is used.
--print-defaults
Print the program argument list and exit.
--no-defaults
Don't read default options from any option file.
--defaults-file=#
Only read default options from the given file #.
--defaults-extra-file=#
Read this file after the global files are read.
--defaults-group-suffix=#
In addition to the default option groups, also read option groups with this suffix.
[mysqlbinlog]
Options read by mariadb-binlog, which includes both MariaDB Server and MySQL Server.
[mariadb-binlog]
Options read by mariadb-binlog.
[client]
Options read by all MariaDB and MySQL client programs, which include both MariaDB and MySQL clients. For example, mysqldump.
[client-server]
Options read by all MariaDB client programs and the MariaDB Server. This is useful for options like socket and port, which are common between the server and the clients.
[client-mariadb]
Options read by all MariaDB client programs.