# gtid_mode

> Whether transactions in the binary log carry GTIDs.

Source: https://sqlly.app/sql-configuration/mysql/gtid-mode
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).

**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](https://sqlly.app/sql-configuration/mysql), or check the [MySQL manual](https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html) for every option.

## Related MySQL settings

- [`enforce_gtid_consistency` Refuse transactions that cannot be logged safely with a GTID.](https://sqlly.app/sql-configuration/mysql/enforce-gtid-consistency)
- [`log_bin` Whether the binary log is enabled.](https://sqlly.app/sql-configuration/mysql/log-bin)
- [`replica_parallel_workers` Applier threads a replica uses to apply transactions in parallel.](https://sqlly.app/sql-configuration/mysql/replica-parallel-workers)
