Common SQL Errors

MySQL Error 1789 ER_MASTER_HAS_PURGED_REQUIRED_GTIDS: Causes and Fixes

Galaxy Team
August 7, 2025

<p>A replica cannot start because the master has already removed binary logs that contain GTIDs the replica still needs.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error code 1789 ER_MASTER_HAS_PURGED_REQUIRED_GTIDS?

<p>MySQL Error 1789 ER_MASTER_HAS_PURGED_REQUIRED_GTIDS appears when a replica connects with MASTER_AUTO_POSITION=1 but the master no longer holds the required GTID events. Restore the missing transactions or rebuild the replica from a fresh backup to resolve the issue.</p>

Error Highlights

Typical Error Message

The slave is connecting using CHANGE MASTER TO

Error Type

Replication Error

Language

MySQL

Symbol

ER_MASTER_HAS_PURGED_REQUIRED_GTIDS

Error Code

1789

SQL State

HY000

Explanation

Table of Contents

What is MySQL error code 1789 ER_MASTER_HAS_PURGED_REQUIRED_GTIDS?

Error 1789 fires during replication startup when the slave requests transactions by GTID but the master no longer has those events in its binary log.

This situation prevents the replica from applying missing transactions and halts replication until manual intervention occurs.

What Causes This Error?

The master purged binary logs too aggressively, deleting GTIDs the replica never fetched.

Long replication lag combined with a short binlog_expire_logs_seconds makes the gap likely.

How to Fix MySQL Error 1789 ER_MASTER_HAS_PURGED_REQUIRED_GTIDS

Restore or re-apply the missing transactions from another peer, backup, or an external binary log archive.

When no source contains the events, rebuild the replica with a full backup taken after the purged GTIDs.

Common Scenarios and Solutions

Adding a new replica: use a recent physical or logical backup of the master rather than starting from empty data files.

Replica after network outage: copy the missing binary logs from another replica that still holds them.

Best Practices to Avoid This Error

Set binlog_expire_logs_seconds longer than the maximum replica lag, including maintenance windows.

Monitor gtid_executed differences with Galaxy or other tools to alert before purge risk appears.

Related Errors and Solutions

Error 1236 occurs for non-GTID replication when the requested binlog is missing. Error 1790 fires when a replica has extra GTIDs not present on the master.

Common Causes

Short Binary Log Retention

The master deletes binlogs quickly because binlog_expire_logs_seconds is set too low for the environment.

Replica Lag

Slow queries, network congestion, or resource limits cause the slave to fall far behind the master.

Manual PURGE BINARY LOGS

An administrator purged logs to free disk space without checking replica status.

Missing Backup Procedures

No off-box archive of binlogs exists, making recovery harder when logs are lost.

Related Errors

Error 1236: master has purged the binary logs

Similar gap but in non-GTID replication.

Error 1790: ER_SLAVE_HAS_MORE_GTIDS_THAN_MASTER

The replica has GTIDs the master lacks, often after failover.

Error 1201: could not find log file on master

General missing binlog error when seeking a specific file.

FAQs

How do I know which GTIDs are missing?

Compare gtid_executed on the master and replica. The replica error output lists the first missing GTID.

Can I skip the missing GTIDs?

Skipping risks data inconsistency. Only skip if you fully understand the business impact.

What binary log retention period is safe?

Set retention longer than the maximum expected replica lag plus extra buffer, often 7-14 days in production.

Does Galaxy help avoid this issue?

Galaxy tracks GTID lag and highlights risky purge settings, letting teams adjust binlog retention before an outage.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo