1628
MariaDBERRORNotableReplicationHIGH confidence

Cannot change binlog_format inside an active transaction

Production Risk

Low — the SET is simply rejected; no data is corrupted.

What this means

Changing the session or global binlog_format variable is not permitted while a transaction is active because it could cause the transaction to be logged in multiple formats.

Why it happens
  1. 1SET binlog_format was executed after a BEGIN or inside a stored routine that is part of an open transaction.
How to reproduce
trigger — this will error
trigger — this will error
BEGIN;
SET SESSION binlog_format = 'ROW';
-- ERROR 1628

expected output

ERROR 1628 (HY000): Cannot change the binlog format inside an active transaction.

Fix

Change binlog_format before starting the transaction

Change binlog_format before starting the transaction
SET SESSION binlog_format = 'ROW';
BEGIN;
-- your statements
COMMIT;

Why this works

Setting the format before BEGIN ensures the entire transaction uses one format.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 1628 ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors