| 1 |
# |
| 2 |
# MDEV-21960 Bind READ_ONLY ADMIN to @@read_only |
| 3 |
# |
| 4 |
# Test that "SET read_only" is not allowed without READ_ONLY ADMIN |
| 5 |
CREATE USER user1@localhost; |
| 6 |
GRANT ALL PRIVILEGES ON *.* TO user1@localhost; |
| 7 |
REVOKE READ_ONLY ADMIN ON *.* FROM user1@localhost; |
| 8 |
connect user1,localhost,user1,,; |
| 9 |
connection user1; |
| 10 |
SET GLOBAL read_only=0; |
| 11 |
ERROR 42000: Access denied; you need (at least one of) the READ_ONLY ADMIN privilege(s) for this operation |
| 12 |
SET read_only=0; |
| 13 |
ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL |
| 14 |
SET SESSION read_only=0; |
| 15 |
ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL |
| 16 |
disconnect user1; |
| 17 |
connection default; |
| 18 |
DROP USER user1@localhost; |
| 19 |
# Test that "SET read_only" is allowed with READ_ONLY ADMIN |
| 20 |
CREATE USER user1@localhost; |
| 21 |
GRANT READ_ONLY ADMIN ON *.* TO user1@localhost; |
| 22 |
connect user1,localhost,user1,,; |
| 23 |
connection user1; |
| 24 |
SET GLOBAL read_only=0; |
| 25 |
SET read_only=0; |
| 26 |
ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL |
| 27 |
SET SESSION read_only=0; |
| 28 |
ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL |
| 29 |
disconnect user1; |
| 30 |
connection default; |
| 31 |
DROP USER user1@localhost; |
| 32 |
# |
| 33 |
# MDEV-29632 SUPER users created before 10.11 should retain READ_ONLY ADMIN privilege upon upgrade |
| 34 |
# |
| 35 |
insert mysql.global_priv values ('bar', 'foo', '{"access":32768,"version_id":101000,"plugin":"mysql_native_password","authentication_string":""}'); |
| 36 |
flush privileges; |
| 37 |
show grants for foo@bar; |
| 38 |
Grants for foo@bar |
| 39 |
GRANT SUPER, BINLOG MONITOR, SET USER, FEDERATED ADMIN, CONNECTION ADMIN, READ_ONLY ADMIN, REPLICATION SLAVE ADMIN, REPLICATION MASTER ADMIN, BINLOG ADMIN, BINLOG REPLAY, SLAVE MONITOR ON *.* TO `foo`@`bar` |
| 40 |
drop user foo@bar; |