Error
Error Code:
1772
MySQL Error 1772: Malformed GTID Set Syntax
Description
Error 1772 indicates that a Global Transaction Identifier (GTID) set string provided in a command or configuration is incorrectly formatted. This typically occurs when MySQL expects a specific GTID set syntax, but the input deviates from it, often during replication management or GTID-related operations.
Error Message
Malformed GTID set specification '%s'.
Known Causes
3 known causesIncorrect GTID Set Format
The GTID set string does not adhere to the required syntax, such as `server_uuid:transaction_id-transaction_id`, due to missing delimiters, incorrect separators, or extra characters.
Invalid UUID or Transaction IDs
The server UUID or the transaction identifiers within the GTID set are not valid hexadecimal values or fall outside expected numerical ranges.
Empty or Unsuitable Input
An empty string, NULL value, or an unparseable string was supplied where a non-empty, syntactically correct GTID set is required.
Solutions
3 solutions available1. Validate GTID Set Syntax easy
Ensure the GTID set string adheres to the correct MySQL format.
1
Review the GTID set string provided in the error message for any syntax errors. Valid GTID sets follow the format 'uuid:interval[:uuid:interval]...'. Common mistakes include missing colons, incorrect UUID format, or invalid interval numbers.
Example of a valid GTID set: 'a1b2c3d4-e5f6-7890-1234-567890abcdef:1-5,fedcba09-8765-4321-fedc-ba0987654321:10-20'
2
If you are manually constructing the GTID set for a command (e.g., `CHANGE MASTER TO` or `SET GLOBAL GTID_PURGED`), carefully re-type or copy-paste the correct GTID set.
mysql> CHANGE MASTER TO MASTER_HOST='master.example.com', MASTER_USER='repl', MASTER_PASSWORD='password', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=12345, MASTER_GTID_ONLY=1, MASTER_AUTO_POSITION=1, GTID_DOMAIN_ID=1, MASTER_CONNECT_RETRY=10;
-- Or for SET GLOBAL GTID_PURGED
mysql> SET GLOBAL GTID_PURGED = 'a1b2c3d4-e5f6-7890-1234-567890abcdef:1-5';
2. Use `SHOW MASTER STATUS` for Correct GTID Information easy
Retrieve the current, valid GTID information from the master server.
1
Connect to your MySQL master server (the source of replication).
mysql -u your_user -p
2
Execute the `SHOW MASTER STATUS` command to get the current replication status, including the GTID set if GTID is enabled.
mysql> SHOW MASTER STATUS;
3
Examine the output for the `Executed_Gtid_Set` column. This value represents the correctly formatted GTID set for your master. Use this exact string when configuring your replica.
Example Output:
+------------------+----------+--------------+------------------+-------------------+----------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | Sequence_Number |
+------------------+----------+--------------+------------------+-------------------+----------------------+
| mysql-bin.000001 | 123 | | | a1b2c3d4-e5f6-7890-1234-567890abcdef:1-5 | 1 |
+------------------+----------+--------------+------------------+-------------------+----------------------+
4
Use the retrieved `Executed_Gtid_Set` in your replication configuration, for example, when setting up `CHANGE MASTER TO` or `CHANGE REPLICATION SOURCE TO` on the replica.
mysql> CHANGE MASTER TO MASTER_HOST='master.example.com', MASTER_USER='repl', MASTER_PASSWORD='password', MASTER_PORT=3306, MASTER_AUTO_POSITION=1, GTID_DOMAIN_ID=1, MASTER_CONNECT_RETRY=10;
-- Or if you need to set GTID_PURGED manually on a replica:
mysql> SET GLOBAL GTID_PURGED = 'a1b2c3d4-e5f6-7890-1234-567890abcdef:1-5';
3. Verify GTID Configuration on Servers medium
Ensure GTID is properly enabled and configured on both master and replica servers.
1
Check the MySQL configuration file (`my.cnf` or `my.ini`) on both the master and replica servers for the following settings under the `[mysqld]` section:
[mysqld]
gtid_mode = ON
enforce_gtid_consistency = ON
server_id = <unique_server_id>
2
If these settings are not present or are set to `OFF`, add or modify them. After changing the configuration, restart the MySQL server for the changes to take effect.
# Example for systemd-based systems (e.g., Ubuntu, CentOS 7+)
sudo systemctl restart mysql
# Example for SysVinit-based systems (e.g., older CentOS/RHEL)
sudo service mysql restart
3
Once the servers are restarted, verify the GTID status by querying the `@@GLOBAL.gtid_mode` and `@@GLOBAL.enforce_gtid_consistency` system variables.
mysql> SELECT @@GLOBAL.gtid_mode, @@GLOBAL.enforce_gtid_consistency;
4
Ensure the `server_id` is unique for each server in the replication topology.
mysql> SELECT @@server_id;