MySQL Error number: 3138; Symbol: ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID; SQLSTATE: HY000 报错 故障修复 远程处理

文档解释

Error number: 3138; Symbol: ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID; SQLSTATE: HY000

Message: Variable %s cannot be changed by a client that owns a GTID. The client owns %s. Ownership is released on COMMIT or ROLLBACK.

Error 3138 (ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID) is an error encountered when trying to set system variables when the server owns a Global Transaction Identifier (GTID).This error indicates that changing a server variable may break replication or binary logging.

Error 3138 occurs when a user attempts to set a server variable that would affect replication or binary logging while a GTID is owned. This usually happens when attempting to set variables such as master_recovery_retry_count, replication_mode, sync_binlog, or binlog_format while a GTID is owned.

Common scenarios where this error may occur include when an administrator attempts to set a variable value that would affect replication. This error also occurs when an attempt is made to change the replication_mode or binlog_format while a GTID is owned by the server.

The best way to fix this error is to stop replication and any other processes that may be using the GTID and then reset the server variable. If the problem persists, it could be a sign of a more serious issue, such as a misconfigured replication setup, server, or database. In these cases, an administrator should review the system configuration and make the necessary changes to correct the problem.

If the user does not want to stop replication or reset the server variables, they can use the SET GTID_IGNORE_VARIABLES statement before executing the SET statement. The GTID_IGNORE_VARIABLES statement will ensure that any setting that would break replication is not affected.

In conclusion, Error 3138 (ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID) appears when trying to set system variables that would affect replication or binary logging while a GTID is owned by the server. The best way to fix this problem is to stop replication and reset the server variables, however, if the user does not want to stop replication they can use the SET GTID_IGNORE_VARIABLES statement. In either case, if the problem persists, an administrator should review the system configuration and make the necessary changes to ensure proper replication and binary logging.


数据运维技术 » MySQL Error number: 3138; Symbol: ER_CANT_SET_VARIABLE_WHEN_OWNING_GTID; SQLSTATE: HY000 报错 故障修复 远程处理