1SET @start_global_value = @@session.gtid_next;
2SELECT @start_global_value;
3@start_global_value
4AUTOMATIC
5select @@global.gtid_next;
6ERROR HY000: Variable 'gtid_next' is a SESSION variable
7select @@session.gtid_next;
8@@session.gtid_next
9AUTOMATIC
10show global variables like 'gtid_next';
11Variable_name	Value
12show session variables like 'gtid_next';
13Variable_name	Value
14gtid_next	AUTOMATIC
15select * from information_schema.global_variables where variable_name='gtid_next';
16VARIABLE_NAME	VARIABLE_VALUE
17select * from information_schema.session_variables where variable_name='gtid_next';
18VARIABLE_NAME	VARIABLE_VALUE
19GTID_NEXT	AUTOMATIC
20set global gtid_next = 1;
21ERROR HY000: Variable 'gtid_next' is a SESSION variable and can't be used with SET GLOBAL
22set session gtid_next = "ANONYMOUS";
23select @@session.gtid_next;
24@@session.gtid_next
25ANONYMOUS
26ROLLBACK;
27set session gtid_next=default;
28select @@session.gtid_next;
29@@session.gtid_next
30AUTOMATIC
31ROLLBACK;
32set session gtid_next=NULL;
33ERROR 42000: Variable 'gtid_next' can't be set to the value of 'NULL'
34select @@session.gtid_next;
35@@session.gtid_next
36AUTOMATIC
37SET @@SESSION.GTID_NEXT = 'ANONYMOUS';
38SET @@SESSION.GTID_NEXT = default;
39ERROR HY000: @@SESSION.GTID_NEXT cannot be changed by a client that owns a GTID. The client owns ANONYMOUS. Ownership is released on COMMIT or ROLLBACK.
40SELECT @@SESSION.GTID_NEXT;
41@@SESSION.GTID_NEXT
42ANONYMOUS
43ROLLBACK;
44set session gtid_next = @start_global_value;
45select @@session.gtid_next;
46@@session.gtid_next
47AUTOMATIC
48