"Impossible to write to binary log" MySQL Error

Last modified by Eleni Cojocariu on 2026/11/25 14:48

Explanation

Saving a page fails, as does anything else that writes to the database, and the logs show:

Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.

XWiki 17.10.14+, 18.4.6+, 18.8.0+ The error typically appears right after upgrading XWiki, which then starts using the READ COMMITTED transaction isolation level.

Cause

The database server writes its binary log in the statement-based format (binlog_format=STATEMENT), and InnoDB cannot record a write made at the READ COMMITTED transaction isolation level in that format, so it rejects the write. XWiki uses READ COMMITTED for the reasons given in MySQL Transaction Isolation Level. MariaDB rejects the write in the same way.

Solution

  1. Check the format of the binary log. Log in as root and run:
    SELECT @@global.binlog_format;
  2. Open the database server's configuration file, /etc/my.cnf on Linux or my.ini on Windows, and in the [mysqld] section either remove the binlog_format=STATEMENT line or set a row-based format:
    [mysqld]
    binlog_format=ROW
  3. Restart the database server so that it reads the new value.
  4. Retry what failed. The query of the first step now returns ROW or MIXED, and the save succeeds.

If the binary log has to stay statement-based, make XWiki use REPEATABLE READ instead, as described in MySQL Transaction Isolation Level, knowing that XWiki's code is not designed for that level.

Related

Get Connected