1#
2# MDEV-21973 Bind REPLICATION {MASTER|SLAVE} ADMIN to gtid_* GLOBAL-only system variables
3#
4# Test that "SET gtid_binlog_state" is not allowed without REPLICATION MASTER ADMIN or SUPER
5CREATE USER user1@localhost;
6GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
7REVOKE REPLICATION MASTER ADMIN, SUPER ON *.* FROM user1@localhost;
8connect user1,localhost,user1,,;
9connection user1;
10SET GLOBAL gtid_binlog_state='0-1-10';
11ERROR 42000: Access denied; you need (at least one of) the SUPER, REPLICATION MASTER ADMIN privilege(s) for this operation
12SET gtid_binlog_state='0-1-10';
13ERROR HY000: Variable 'gtid_binlog_state' is a GLOBAL variable and should be set with SET GLOBAL
14SET SESSION gtid_binlog_state='0-1-10';
15ERROR HY000: Variable 'gtid_binlog_state' is a GLOBAL variable and should be set with SET GLOBAL
16disconnect user1;
17connection default;
18DROP USER user1@localhost;
19# Test that "SET gtid_binlog_state" is allowed with REPLICATION MASTER ADMIN
20CREATE USER user1@localhost;
21GRANT REPLICATION MASTER ADMIN ON *.* TO user1@localhost;
22connect user1,localhost,user1,,;
23connection user1;
24SET GLOBAL gtid_binlog_state='0-1-10';
25ERROR HY000: Binlog closed, cannot RESET MASTER
26SET gtid_binlog_state='0-1-10';
27ERROR HY000: Variable 'gtid_binlog_state' is a GLOBAL variable and should be set with SET GLOBAL
28SET SESSION gtid_binlog_state='0-1-10';
29ERROR HY000: Variable 'gtid_binlog_state' is a GLOBAL variable and should be set with SET GLOBAL
30disconnect user1;
31connection default;
32DROP USER user1@localhost;
33# Test that "SET gtid_binlog_state" is allowed with SUPER
34CREATE USER user1@localhost;
35GRANT SUPER ON *.* TO user1@localhost;
36connect user1,localhost,user1,,;
37connection user1;
38SET GLOBAL gtid_binlog_state='0-1-10';
39ERROR HY000: Binlog closed, cannot RESET MASTER
40SET gtid_binlog_state='0-1-10';
41ERROR HY000: Variable 'gtid_binlog_state' is a GLOBAL variable and should be set with SET GLOBAL
42SET SESSION gtid_binlog_state='0-1-10';
43ERROR HY000: Variable 'gtid_binlog_state' is a GLOBAL variable and should be set with SET GLOBAL
44disconnect user1;
45connection default;
46DROP USER user1@localhost;
47