3209
MariaDBERRORCommonReplicationHIGH confidence

Cannot modify GTID_EXECUTED — it is read-only

Production Risk

High — incorrect GTID manipulation can break replication.

Why it happens
  1. 1Attempting to SET GLOBAL GTID_EXECUTED, which is a read-only system variable.
  2. 2GTID_EXECUTED is managed internally by the MySQL replication system.
How to reproduce
trigger — this will error
trigger — this will error
SET GLOBAL gtid_executed = '';

expected output

ERROR 3209 (HY000): Cannot modify GTID_EXECUTED: it is a read-only variable.

Fix 1

Use RESET MASTER to clear GTID state

Use RESET MASTER to clear GTID state
RESET MASTER;

Why this works

RESET MASTER clears the binary log and resets GTID_EXECUTED (use with caution in replication setups).

Fix 2

Inject a GTID via SQL_LOG_BIN=0 + GTID_NEXT

Inject a GTID via SQL_LOG_BIN=0 + GTID_NEXT
SET GTID_NEXT = 'uuid:N'; BEGIN; COMMIT; SET GTID_NEXT = 'AUTOMATIC';

Why this works

Injects a synthetic transaction to skip or fill a GTID gap.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3209 ER_CANNOT_MODIFY_GTID_EXECUTED

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

← All MariaDB errors