1773
MySQLERRORNotableReplicationHIGH confidence

Cannot set gtid_purged when gtid_executed is not empty

Production Risk

Medium — GTID inconsistency if mishandled.

What this means

SET GLOBAL gtid_purged failed because gtid_executed is not empty, meaning transactions have already been applied and the purged set cannot be overwritten.

Why it happens
  1. 1The server has already applied transactions, so gtid_executed is non-empty.
  2. 2Attempting to set gtid_purged on a server that has been running with GTID mode.
How to reproduce
trigger — this will error
trigger — this will error
SET GLOBAL gtid_purged = 'xxxxxxxx:1-50'; -- gtid_executed is already non-empty

expected output

ERROR 1773 (HY000): Cannot set GTID_PURGED to the value when GTID_EXECUTED is not empty.

Fix

Reset binary logs to clear gtid_executed before setting gtid_purged

Reset binary logs to clear gtid_executed before setting gtid_purged
RESET MASTER;
SET GLOBAL gtid_purged = 'xxxxxxxx:1-50';

Why this works

RESET MASTER clears gtid_executed, allowing gtid_purged to be set to the desired value.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 1773 ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY

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

← All MySQL errors