Display the contents of a file named mariadb-bin.000152 like this:
Processing a Single Log File
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.
Processing Multiple Log Files
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: