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 or SUPER 5CREATE USER user1@localhost; 6GRANT ALL PRIVILEGES ON *.* TO user1@localhost; 7REVOKE READ_ONLY ADMIN, SUPER ON *.* FROM user1@localhost; 8connect user1,localhost,user1,,; 9connection user1; 10SET GLOBAL read_only=0; 11ERROR 42000: Access denied; you need (at least one of) the SUPER, READ_ONLY ADMIN privilege(s) for this operation 12SET read_only=0; 13ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL 14SET SESSION read_only=0; 15ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL 16disconnect user1; 17connection default; 18DROP USER user1@localhost; 19# Test that "SET read_only" is allowed with READ_ONLY ADMIN 20CREATE USER user1@localhost; 21GRANT READ_ONLY ADMIN ON *.* TO user1@localhost; 22connect user1,localhost,user1,,; 23connection user1; 24SET GLOBAL read_only=0; 25SET read_only=0; 26ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL 27SET SESSION read_only=0; 28ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL 29disconnect user1; 30connection default; 31DROP USER user1@localhost; 32# Test that "SET read_only" is allowed with SUPER 33CREATE USER user1@localhost; 34GRANT SUPER ON *.* TO user1@localhost; 35connect user1,localhost,user1,,; 36connection user1; 37SET GLOBAL read_only=0; 38SET read_only=0; 39ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL 40SET SESSION read_only=0; 41ERROR HY000: Variable 'read_only' is a GLOBAL variable and should be set with SET GLOBAL 42disconnect user1; 43connection default; 44DROP USER user1@localhost; 45