1RESET MASTER; 2SET @start_global_value = @@global.gtid_purged; 3SELECT @start_global_value; 4@start_global_value 5 6SET @sql_log_bin_start_value = @@session.sql_log_bin; 7select @@global.gtid_purged; 8@@global.gtid_purged 9 10select @@session.gtid_purged; 11ERROR HY000: Variable 'gtid_purged' is a GLOBAL variable 12show global variables like 'gtid_purged'; 13Variable_name Value 14gtid_purged 15show session variables like 'gtid_purged'; 16Variable_name Value 17gtid_purged 18select * from information_schema.global_variables where variable_name='gtid_purged'; 19VARIABLE_NAME VARIABLE_VALUE 20GTID_PURGED 21select * from information_schema.session_variables where variable_name='gtid_purged'; 22VARIABLE_NAME VARIABLE_VALUE 23GTID_PURGED 24set @@global.gtid_purged = NULL; 25ERROR 42000: Variable 'gtid_purged' can't be set to the value of 'NULL' 26select @@global.gtid_purged; 27@@global.gtid_purged 28 29set @@global.gtid_purged = default; 30ERROR 42000: Variable 'gtid_purged' doesn't have a default value 31select @@global.gtid_purged; 32@@global.gtid_purged 33 34SET @@global.gtid_purged= '11111111-1111-1111-1111-111111111111:1-2'; 35SELECT @@global.gtid_purged; 36@@global.gtid_purged 3711111111-1111-1111-1111-111111111111:1-2 38SET @@global.gtid_purged= '11111111-1111-1111-1111-111111111111:3'; 39ERROR HY000: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is empty. 40SELECT @@global.gtid_purged; 41@@global.gtid_purged 4211111111-1111-1111-1111-111111111111:1-2 43RESET MASTER; 44SET AUTOCOMMIT= OFF; 45SET @@global.gtid_purged= '11111111-1111-1111-1111-111111111111:4-5'; 46SET @@session.sql_log_bin= @sql_log_bin_start_value; 47SET AUTOCOMMIT= ON; 48RESET MASTER; 49SELECT @@global.gtid_purged; 50@@global.gtid_purged 51 52