1634
MySQLERRORNotableReplicationHIGH confidence

Cannot change binlog_direct_non_transactional_updates inside an active transaction

Production Risk

Low — the SET is rejected; no data loss.

What this means

The variable binlog_direct_non_transactional_updates cannot be changed while a transaction is in progress.

Why it happens
  1. 1A SET SESSION binlog_direct_non_transactional_updates statement was executed after a transaction began.
How to reproduce
trigger — this will error
trigger — this will error
BEGIN;
SET SESSION binlog_direct_non_transactional_updates = ON;

expected output

ERROR 1634 (HY000): Cannot change the binlog direct flag inside an active transaction.

Fix

Set the variable before starting the transaction

Set the variable before starting the transaction
SET SESSION binlog_direct_non_transactional_updates = ON;
BEGIN;

Why this works

Setting the variable before BEGIN ensures consistent logging throughout the transaction.

Sources
Official documentation ↗

MySQL 8.0 — 1634 ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT

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

← All MySQL errors