gtid_mode
Whether transactions in the binary log carry GTIDs.
- Default
OFF- Range
- OFF, OFF_PERMISSIVE, ON_PERMISSIVE, ON
- Restart needed
- No
- Default checked on
- MySQL 8.4 LTS
What it does
OFF keeps every transaction anonymous, identified by binary log file and position; ON gives every transaction a globally unique GTID. OFF_PERMISSIVE and ON_PERMISSIVE are the two transition steps: the first accepts replicated GTID transactions while writing new ones anonymous, the second writes GTIDs while still accepting anonymous ones.
Default value
OFF. OFF (MySQL 8.4). GTID mode can be changed online since MySQL 5.7.6, one step at a time in either direction.
Check the current value
SHOW GLOBAL VARIABLES LIKE 'gtid_mode'; SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME FROM performance_schema.variables_info WHERE VARIABLE_NAME = 'gtid_mode';
Change it
SET GLOBAL gtid_mode = ON_PERMISSIVE; -- until the next restart SET PERSIST gtid_mode = ON_PERMISSIVE; -- now and after restarts
No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.
When to change it
When moving a topology to GTID replication for simpler failover and replica provisioning: set enforce_gtid_consistency=ON first, then step OFF, OFF_PERMISSIVE, ON_PERMISSIVE, ON, letting anonymous traffic drain between steps.
What can go wrong
The value moves only one step at a time; SET GLOBAL gtid_mode = ON straight from OFF fails outright. With ON, anonymous replicated transactions are refused, so every server must have drained its anonymous transactions before the last step, and a server still writing anonymous transactions breaks failover tooling that assumes GTID sets.
Questions about gtid_mode
What is the default value of gtid_mode in MySQL?
OFF. OFF (MySQL 8.4). GTID mode can be changed online since MySQL 5.7.6, one step at a time in either direction.
Does changing gtid_mode require a restart?
No. No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.
When should I change gtid_mode?
When moving a topology to GTID replication for simpler failover and replica provisioning: set enforce_gtid_consistency=ON first, then step OFF, OFF_PERMISSIVE, ON_PERMISSIVE, ON, letting anonymous traffic drain between steps.
Back to all MySQL settings, or check the MySQL manual for every option.
Check gtid_mode on your own server
SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.
Text and data on this page: CC BY 4.0, credit SQLly (sqlly.app). Code and SQL snippets: MIT. License details View as Markdown