Warning
Error Code: 3129

MySQL Error 3129: Modifying Internal GTID Table

📦 MySQL
📋

Description

Error 3129 occurs when a user or an automated process attempts to directly modify the `mysql.gtid_executed` system table. This table is critical for MySQL's Global Transaction Identifiers (GTIDs) and replication, storing GTIDs for all committed transactions. Direct modification is strictly prohibited as it can lead to an inconsistent GTID state and severe replication issues.
💬

Error Message

Please do not modify the %s table. This is a mysql internal system table to store GTIDs for committed transactions. Modifying it can lead to an inconsistent GTID state.
🔍

Known Causes

3 known causes
⚠️
Direct SQL Manipulation
A user executed `INSERT`, `UPDATE`, `DELETE`, or `TRUNCATE` statements directly on the `mysql.gtid_executed` table.
⚠️
Automated Script Error
An administrative script, custom application, or third-party tool inadvertently or incorrectly tried to alter the `mysql.gtid_executed` table.
⚠️
Misconception of GTID Management
The user attempted to manually manage or clean up GTIDs by interacting with this internal table, unaware of the proper procedures or its critical role.
🛠️

Solutions

3 solutions available

1. Identify and Cease Unauthorized GTID Table Modifications easy

Locate the source of the modification attempt and prevent it from happening again.

1
Review your application code, scripts, and any automation tools that interact with your MySQL database. Look for any statements that attempt to `INSERT`, `UPDATE`, `DELETE`, or `TRUNCATE` data in tables related to GTID information. The specific table name will be mentioned in the error message (e.g., `mysql.gtid_executed`).
2
If you find any such statements, remove or comment them out. These tables are managed by MySQL itself and should not be directly manipulated.
3
Restart the MySQL server to ensure that any in-memory state related to the attempted modification is cleared.
sudo systemctl restart mysql
# or
systemctl restart mariadb

2. Verify GTID Configuration and Status medium

Ensure GTID is correctly configured and that no external processes are trying to force GTID state.

1
Connect to your MySQL server as a user with sufficient privileges (e.g., root).
2
Check the current GTID status by querying the `@@GLOBAL.gtid_mode` and `@@SESSION.gtid_mode` variables.
SHOW GLOBAL VARIABLES LIKE 'gtid_mode';
SHOW SESSION VARIABLES LIKE 'gtid_mode';
3
If `gtid_mode` is not `ON` or `OFF` (depending on your intended configuration), and you are experiencing this error, it might indicate an issue with how GTID was enabled or a misconfiguration. Consult MySQL documentation for proper GTID setup.
4
Examine the `mysql.gtid_executed` table (if you can access it without triggering the error again, which is unlikely). This table should not be directly queried or modified by users. If you suspect corruption, a more involved recovery process might be needed.

3. Restore from a Known Good Backup advanced

If the GTID state is suspected to be irrecoverably corrupted, restoring from a backup is the safest approach.

1
Identify your most recent, known-good backup of the MySQL database.
2
Stop the MySQL server to prevent any further writes or inconsistencies.
sudo systemctl stop mysql
# or
systemctl stop mariadb
3
Perform a full data directory restore from your backup. The exact steps depend on your backup method (e.g., `mysqldump`, Percona XtraBackup, file system snapshot). For file-based backups, this usually involves replacing the contents of the MySQL data directory.
Example using a file system snapshot (replace paths with your actual paths):
rsync -av /path/to/backup/data/ /var/lib/mysql/
4
Ensure file ownership and permissions are correct for the MySQL user (e.g., `mysql:mysql`).
sudo chown -R mysql:mysql /var/lib/mysql/
5
Start the MySQL server.
sudo systemctl start mysql
# or
systemctl start mariadb
6
After the server starts, verify that the GTID state is consistent by checking replication status and performing basic queries.
🔗

Related Errors

5 related errors