| 1 |
# |
| 2 |
# MDEV-21975 Add BINLOG REPLAY privilege and bind new privileges to gtid_seq_no, preudo_thread_id, server_id, gtid_domain_id |
| 3 |
# |
| 4 |
SET @global=@@global.server_id; |
| 5 |
# Test that "SET GLOBAL server_id" is not allowed without REPLICATION MASTER ADMIN |
| 6 |
CREATE USER user1@localhost; |
| 7 |
GRANT ALL PRIVILEGES ON *.* TO user1@localhost; |
| 8 |
REVOKE REPLICATION MASTER ADMIN ON *.* FROM user1@localhost; |
| 9 |
connect user1,localhost,user1,,; |
| 10 |
connection user1; |
| 11 |
SET GLOBAL server_id=1; |
| 12 |
ERROR 42000: Access denied; you need (at least one of) the REPLICATION MASTER ADMIN privilege(s) for this operation |
| 13 |
disconnect user1; |
| 14 |
connection default; |
| 15 |
DROP USER user1@localhost; |
| 16 |
# Test that "SET GLOBAL server_id" is allowed with REPLICATION MASTER ADMIN |
| 17 |
CREATE USER user1@localhost; |
| 18 |
GRANT REPLICATION MASTER ADMIN ON *.* TO user1@localhost; |
| 19 |
connect user1,localhost,user1,,; |
| 20 |
connection user1; |
| 21 |
SET GLOBAL server_id=1; |
| 22 |
disconnect user1; |
| 23 |
connection default; |
| 24 |
DROP USER user1@localhost; |
| 25 |
SET @@global.server_id=@global; |
| 26 |
SET @session=@@session.server_id; |
| 27 |
# Test that "SET server_id" is not allowed without BINLOG REPLAY |
| 28 |
CREATE USER user1@localhost; |
| 29 |
GRANT ALL PRIVILEGES ON *.* TO user1@localhost; |
| 30 |
REVOKE BINLOG REPLAY ON *.* FROM user1@localhost; |
| 31 |
connect user1,localhost,user1,,; |
| 32 |
connection user1; |
| 33 |
SET server_id=1; |
| 34 |
ERROR 42000: Access denied; you need (at least one of) the BINLOG REPLAY privilege(s) for this operation |
| 35 |
SET SESSION server_id=1; |
| 36 |
ERROR 42000: Access denied; you need (at least one of) the BINLOG REPLAY privilege(s) for this operation |
| 37 |
disconnect user1; |
| 38 |
connection default; |
| 39 |
DROP USER user1@localhost; |
| 40 |
# Test that "SET server_id" is allowed with BINLOG REPLAY |
| 41 |
CREATE USER user1@localhost; |
| 42 |
GRANT BINLOG REPLAY ON *.* TO user1@localhost; |
| 43 |
connect user1,localhost,user1,,; |
| 44 |
connection user1; |
| 45 |
SET server_id=1; |
| 46 |
SET SESSION server_id=1; |
| 47 |
disconnect user1; |
| 48 |
connection default; |
| 49 |
DROP USER user1@localhost; |
| 50 |
SET @@session.server_id=@session; |