3114
MariaDBERRORNotableReplicationHIGH confidence

Cannot set gtid_purged when GTID mode is OFF

Production Risk

Medium — restore or replication setup fails if not handled correctly.

What this means

The gtid_purged system variable cannot be set when GTID mode is disabled on the server.

Why it happens
  1. 1Attempting SET @@GLOBAL.gtid_purged when gtid_mode = OFF.
  2. 2Restoring a mysqldump with SET @@GLOBAL.gtid_purged on a server with GTID mode disabled.
How to reproduce
trigger — this will error
trigger — this will error
SET @@GLOBAL.gtid_purged = 'server-uuid:1-100';

expected output

ERROR 3114 (HY000): Cannot set gtid_purged when GTID mode is disabled.

Fix 1

Enable GTID mode before setting gtid_purged

Enable GTID mode before setting gtid_purged
SET GLOBAL gtid_mode = ON;
SET @@GLOBAL.gtid_purged = 'server-uuid:1-100';

Why this works

GTID mode must be enabled for gtid_purged to be meaningful.

Fix 2

Skip the gtid_purged line when restoring on non-GTID server

Skip the gtid_purged line when restoring on non-GTID server
-- Use --set-gtid-purged=OFF with mysqldump restore

Why this works

Omits GTID-related SET statements when restoring to a non-GTID server.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3114 ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF2

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

← All MariaDB errors