# Binary Log

The binary log (binlog) contains a record of all changes to the databases.

{% columns %}
{% column %}
{% content-ref url="binary-log/overview-of-the-binary-log" %}
[overview-of-the-binary-log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/overview-of-the-binary-log)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Introduction to the purpose and structure of the binary log, explaining how it records data changes (DML[^1]) and structure changes (DDL[^2]) for replication and recovery.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/activating-the-binary-log" %}
[activating-the-binary-log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/activating-the-binary-log)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Instructions for enabling the binary log using the `--log-bin` option and configuring the log file basename and index file.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/binary-log-formats" %}
[binary-log-formats](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/binary-log-formats)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Detailed comparison of the three binary logging formats: Statement-based (SBR), Row-based (RBR), and Mixed, including their pros, cons, and configuration via binlog\_format.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/using-and-maintaining-the-binary-log" %}
[using-and-maintaining-the-binary-log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/using-and-maintaining-the-binary-log)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Complete binary log maintenance: `PURGE BINARY LOGS`/`RESET MASTER`, `expire_logs_days` & `binlog_expire_logs_seconds`, `FLUSH BINARY LOGS`, and `SHOW SLAVE STATUS`.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/innodb-based-binary-log" %}
[innodb-based-binary-log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/innodb-based-binary-log)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
MariaDB 12.3 introduces a new binary log implementation that stores binlog events directly in InnoDB-managed tablespaces instead of separate files on disk.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/compressing-events-to-reduce-size-of-the-binary-log" %}
[compressing-events-to-reduce-size-of-the-binary-log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/compressing-events-to-reduce-size-of-the-binary-log)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Guide to using the `log_bin_compress` system variable to compress binary log events, reducing storage usage and network bandwidth during replication.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/flashback" %}
[flashback](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/flashback)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Explains how to use the Flashback feature (via `mysqlbinlog --flashback`) to rollback transactions by reversing the binary log events, useful for recovering from accidental data modifications.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/group-commit-for-the-binary-log" %}
[group-commit-for-the-binary-log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/group-commit-for-the-binary-log)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Describes the group commit optimization, which improves performance by committing multiple transactions to the binary log in a single disk I/O operation.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/relay-log" %}
[relay-log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/relay-log)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Overview of the relay log, a set of log files created by a replica server to store events received from the primary's binary log before executing them.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="binary-log/selectively-skipping-replication-of-binlog-events" %}
[selectively-skipping-replication-of-binlog-events](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/selectively-skipping-replication-of-binlog-events)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Learn techniques to bypass specific replication events. This guide explains how to ignore individual transactions or errors to restore replication flow after a stoppage.
{% endcolumn %}
{% endcolumns %}

[^1]: DML (Data Manipulation Language): The subset of SQL commands used to add, modify, retrieve, or delete data within existing database tables.

[^2]: DDL (Data Definition Language): The subset of SQL commands used to create, modify, or destroy the structure of database objects (like tables, indexes, and databases) rather than the data itself.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
