Merge branch '10.3' into 10.4

This commit is contained in:
Oleksandr Byelkin 2020-02-11 14:40:35 +01:00
commit 646d1ec83a
164 changed files with 2854 additions and 2282 deletions

View file

@ -27,22 +27,22 @@ grant select on *.* to foo@localhost with admin option;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'admin option' at line 1
show grants for foo@localhost;
Grants for foo@localhost
GRANT CREATE USER ON *.* TO 'foo'@'localhost'
GRANT role1 TO 'foo'@'localhost' WITH ADMIN OPTION
GRANT role2 TO 'foo'@'localhost'
GRANT role5 TO 'foo'@'localhost' WITH ADMIN OPTION
GRANT CREATE USER ON *.* TO `foo`@`localhost`
GRANT `role1` TO `foo`@`localhost` WITH ADMIN OPTION
GRANT `role2` TO `foo`@`localhost`
GRANT `role5` TO `foo`@`localhost` WITH ADMIN OPTION
show grants for role1;
Grants for role1
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT role2 TO 'role1'
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role4 TO 'role3' WITH ADMIN OPTION
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT `role2` TO `role1`
GRANT `role3` TO `role1` WITH ADMIN OPTION
GRANT `role4` TO `role3` WITH ADMIN OPTION
show grants for role4;
Grants for role4
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO `role4`
select * from mysql.roles_mapping;
Host User Role Admin_option
role1 role2 N
@ -58,22 +58,22 @@ localhost root role4 Y
flush privileges;
show grants for foo@localhost;
Grants for foo@localhost
GRANT CREATE USER ON *.* TO 'foo'@'localhost'
GRANT role1 TO 'foo'@'localhost' WITH ADMIN OPTION
GRANT role2 TO 'foo'@'localhost'
GRANT role5 TO 'foo'@'localhost' WITH ADMIN OPTION
GRANT CREATE USER ON *.* TO `foo`@`localhost`
GRANT `role1` TO `foo`@`localhost` WITH ADMIN OPTION
GRANT `role2` TO `foo`@`localhost`
GRANT `role5` TO `foo`@`localhost` WITH ADMIN OPTION
show grants for role1;
Grants for role1
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT role2 TO 'role1'
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role4 TO 'role3' WITH ADMIN OPTION
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT `role2` TO `role1`
GRANT `role3` TO `role1` WITH ADMIN OPTION
GRANT `role4` TO `role3` WITH ADMIN OPTION
show grants for role4;
Grants for role4
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO `role4`
select * from information_schema.applicable_roles;
GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT
role1 role2 NO NULL
@ -89,21 +89,21 @@ revoke admin option for role2 from foo@localhost;
revoke admin option for role1 from root@localhost;
show grants for foo@localhost;
Grants for foo@localhost
GRANT CREATE USER ON *.* TO 'foo'@'localhost'
GRANT role2 TO 'foo'@'localhost'
GRANT role5 TO 'foo'@'localhost' WITH ADMIN OPTION
GRANT CREATE USER ON *.* TO `foo`@`localhost`
GRANT `role2` TO `foo`@`localhost`
GRANT `role5` TO `foo`@`localhost` WITH ADMIN OPTION
show grants for role1;
Grants for role1
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT role2 TO 'role1' WITH ADMIN OPTION
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role4 TO 'role3'
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT `role2` TO `role1` WITH ADMIN OPTION
GRANT `role3` TO `role1` WITH ADMIN OPTION
GRANT `role4` TO `role3`
show grants for role4;
Grants for role4
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO `role4`
select * from mysql.roles_mapping;
Host User Role Admin_option
role1 role2 Y
@ -118,21 +118,21 @@ localhost root role4 Y
flush privileges;
show grants for foo@localhost;
Grants for foo@localhost
GRANT CREATE USER ON *.* TO 'foo'@'localhost'
GRANT role2 TO 'foo'@'localhost'
GRANT role5 TO 'foo'@'localhost' WITH ADMIN OPTION
GRANT CREATE USER ON *.* TO `foo`@`localhost`
GRANT `role2` TO `foo`@`localhost`
GRANT `role5` TO `foo`@`localhost` WITH ADMIN OPTION
show grants for role1;
Grants for role1
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT role2 TO 'role1' WITH ADMIN OPTION
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role4 TO 'role3'
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT `role2` TO `role1` WITH ADMIN OPTION
GRANT `role3` TO `role1` WITH ADMIN OPTION
GRANT `role4` TO `role3`
show grants for role4;
Grants for role4
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO `role4`
select * from information_schema.applicable_roles;
GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT
role1 role2 YES NULL

View file

@ -66,8 +66,8 @@ localhost r1 r2 N
localhost root r2 Y
SHOW GRANTS FOR r1@localhost;
Grants for r1@localhost
GRANT r2 TO 'r1'@'localhost'
GRANT USAGE ON *.* TO 'r1'@'localhost'
GRANT `r2` TO `r1`@`localhost`
GRANT USAGE ON *.* TO `r1`@`localhost`
DROP USER u1;
DROP ROLE r2;
DROP USER r1@localhost;
@ -85,5 +85,5 @@ select * from mysql.roles_mapping;
Host User Role Admin_option
show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION

View file

@ -13,14 +13,14 @@ Host User Role Admin_option
localhost root r1 Y
show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'r1'
GRANT r1 TO 'root'@'localhost' WITH ADMIN OPTION
GRANT USAGE ON *.* TO `r1`
GRANT `r1` TO `root`@`localhost` WITH ADMIN OPTION
drop role r1;
select * from mysql.roles_mapping;
Host User Role Admin_option
show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION

View file

@ -38,9 +38,9 @@ connect c1, localhost, foo,,mysqltest1;
connection c1;
show grants;
Grants for foo@localhost
GRANT role4 TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT CREATE VIEW ON `mysqltest1`.* TO 'foo'@'localhost'
GRANT `role4` TO `foo`@`localhost`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT CREATE VIEW ON `mysqltest1`.* TO `foo`@`localhost`
select * from test.v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select * from test.v2;
@ -622,13 +622,13 @@ prepare stmt1 from 'grant select on *.* to utest';
execute stmt1;
show grants for utest;
Grants for utest@%
GRANT SELECT ON *.* TO 'utest'@'%'
GRANT SELECT ON *.* TO `utest`@`%`
drop user utest;
create role utest;
execute stmt1;
show grants for utest;
Grants for utest
GRANT SELECT ON *.* TO 'utest'
GRANT SELECT ON *.* TO `utest`
drop role utest;
#
# MDEV-13676: Field "create Procedure" is NULL, even if the the user

View file

@ -7,15 +7,15 @@ grant r3 to r2;
grant r1 to u1;
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT r1 TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
GRANT `r1` TO `u1`@`%`
show grants for r1;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT r2 TO 'r1'
GRANT r3 TO 'r2'
GRANT USAGE ON *.* TO `r1`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT `r2` TO `r1`
GRANT `r3` TO `r2`
grant SELECT on *.* to u1;
grant INSERT on mysql.* to r1;
grant DELETE on mysql.roles_mapping to r2;
@ -33,30 +33,30 @@ revoke execute on procedure mysql.test_proc from r2;
ERROR 42000: There is no such grant defined for user 'r2' on host '' on routine 'test_proc'
show grants for r1;
Grants for r1
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT INSERT ON `mysql`.* TO 'r1'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT r2 TO 'r1'
GRANT r3 TO 'r2'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `r2`
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT INSERT ON `mysql`.* TO `r1`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r1`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT `r2` TO `r1`
GRANT `r3` TO `r2`
show grants for r2;
Grants for r2
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT r3 TO 'r2'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `r2`
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT `r3` TO `r2`
show grants for r3;
Grants for r3
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r3'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r3`
drop function mysql.test_func;
drop procedure mysql.test_proc;
create function mysql.test_func (s CHAR(20))
@ -64,11 +64,11 @@ returns CHAR(50) DETERMINISTIC
return concat('Test string: ',s);
show grants for r2;
Grants for r2
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT r3 TO 'r2'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT `r3` TO `r2`
connect u1,localhost,u1,,;
select mysql.test_func("none");
ERROR 42000: execute command denied to user 'u1'@'%' for routine 'mysql.test_func'

View file

@ -20,15 +20,15 @@ grant select on m_.* to r2;
grant r2 to r1;
show grants for u1@localhost;
Grants for u1@localhost
GRANT r1 TO 'u1'@'localhost'
GRANT USAGE ON *.* TO 'u1'@'localhost'
GRANT `r1` TO `u1`@`localhost`
GRANT USAGE ON *.* TO `u1`@`localhost`
show grants for r1;
Grants for r1
GRANT r2 TO 'r1'
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO 'r2'
GRANT SELECT ON `test`.* TO 'r2'
GRANT SELECT ON `m_`.* TO 'r2'
GRANT `r2` TO `r1`
GRANT USAGE ON *.* TO `r1`
GRANT USAGE ON *.* TO `r2`
GRANT SELECT ON `test`.* TO `r2`
GRANT SELECT ON `m_`.* TO `r2`
drop user u1@localhost;
drop role r1, r2;
insert mysql.db select * from db_copy;

View file

@ -21,13 +21,13 @@ show tables in mysqltest2;
Tables_in_mysqltest2
show grants;
Grants for foo@localhost
GRANT r2 TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT r1 TO 'r2'
GRANT USAGE ON *.* TO 'r2'
GRANT ALL PRIVILEGES ON `mysqltest2`.* TO 'r2'
GRANT USAGE ON *.* TO 'r1'
GRANT ALL PRIVILEGES ON `mysqltest1`.* TO 'r1'
GRANT `r2` TO `foo`@`localhost`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT `r1` TO `r2`
GRANT USAGE ON *.* TO `r2`
GRANT ALL PRIVILEGES ON `mysqltest2`.* TO `r2`
GRANT USAGE ON *.* TO `r1`
GRANT ALL PRIVILEGES ON `mysqltest1`.* TO `r1`
connection default;
drop user foo@localhost;
drop role r1;

View file

@ -9,8 +9,8 @@ current_user
@localhost
show grants;
Grants for @localhost
GRANT r1 TO ''@'localhost'
GRANT USAGE ON *.* TO ''@'localhost'
GRANT `r1` TO ``@`localhost`
GRANT USAGE ON *.* TO ``@`localhost`
connection default;
drop role r1;
drop user ''@localhost;

View file

@ -3,7 +3,7 @@ create user user;
grant proxy on r1 to user;
show grants for user;
Grants for user@%
GRANT USAGE ON *.* TO 'user'@'%'
GRANT USAGE ON *.* TO `user`@`%`
GRANT PROXY ON 'r1'@'%' TO 'user'@'%'
drop user user;
drop role r1;

View file

@ -15,30 +15,30 @@ r1
grant select on *.* to current_role;
show grants for current_role;
Grants for r1
GRANT SELECT ON *.* TO 'r1'
GRANT INSERT ON `test`.* TO 'r1'
GRANT SELECT ON *.* TO `r1`
GRANT INSERT ON `test`.* TO `r1`
revoke insert on test.* from current_role;
show grants for current_role;
Grants for r1
GRANT SELECT ON *.* TO 'r1'
GRANT SELECT ON *.* TO `r1`
revoke all, grant option from current_role;
show grants for current_role;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
set password=password('foobar');
show grants;
Grants for root@localhost
GRANT r1 TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION
GRANT `r1` TO `root`@`localhost` WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
grant r1 to current_user() identified by 'barfoo';
show grants;
Grants for root@localhost
GRANT r1 TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION
GRANT `r1` TO `root`@`localhost` WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
set password='';
drop role r1;
update mysql.global_priv set priv=@root_priv;

View file

@ -4,8 +4,8 @@ grant r1 to foo@'127.0.0.1';
connect con1,127.0.0.1,foo,,;
show grants;
Grants for foo@127.0.0.1
GRANT r1 TO 'foo'@'127.0.0.1'
GRANT USAGE ON *.* TO 'foo'@'127.0.0.1'
GRANT `r1` TO `foo`@`127.0.0.1`
GRANT USAGE ON *.* TO `foo`@`127.0.0.1`
set role r1;
select * from information_schema.enabled_roles;
ROLE_NAME

View file

@ -17,8 +17,8 @@ User Host is_role
developers Y
SHOW GRANTS;
Grants for root@localhost
GRANT developers TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT `developers` TO `root`@`localhost` WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
# Test reexecution.
EXECUTE stmtCreateRole;
@ -40,8 +40,8 @@ Host User Role Admin_option
localhost root developers Y
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT developers TO 'test_user'@'%'
GRANT USAGE ON *.* TO 'test_user'@'%'
GRANT `developers` TO `test_user`@`%`
GRANT USAGE ON *.* TO `test_user`@`%`
#
# Test revoking a role.
#
@ -52,16 +52,16 @@ EXECUTE stmtRevokeRole;
ERROR HY000: Cannot revoke role 'developers' from: 'test_user'@'%'
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
GRANT USAGE ON *.* TO `test_user`@`%`
EXECUTE stmtGrantRole;
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT developers TO 'test_user'@'%'
GRANT USAGE ON *.* TO 'test_user'@'%'
GRANT `developers` TO `test_user`@`%`
GRANT USAGE ON *.* TO `test_user`@`%`
EXECUTE stmtRevokeRole;
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
GRANT USAGE ON *.* TO `test_user`@`%`
#
# Now drop the role.
#
@ -78,11 +78,11 @@ SELECT * FROM mysql.roles_mapping;
Host User Role Admin_option
SHOW GRANTS;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
GRANT USAGE ON *.* TO `test_user`@`%`
#
# Test reexecution.
#
@ -96,12 +96,12 @@ Host User Role Admin_option
localhost root developers Y
SHOW GRANTS;
Grants for root@localhost
GRANT developers TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT `developers` TO `root`@`localhost` WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT USAGE ON *.* TO 'test_user'@'%'
GRANT USAGE ON *.* TO `test_user`@`%`
EXECUTE stmtDropRole;
# Cleanup.
DROP USER test_user;

View file

@ -3,16 +3,16 @@ create user u1;
grant r1 to u1;
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT r1 TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
GRANT `r1` TO `u1`@`%`
create user u2;
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT r1 TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
GRANT `r1` TO `u1`@`%`
show grants for u2;
Grants for u2@%
GRANT USAGE ON *.* TO 'u2'@'%'
GRANT USAGE ON *.* TO `u2`@`%`
select * from mysql.roles_mapping;
Host User Role Admin_option
% u1 r1 N
@ -22,7 +22,7 @@ revoke r1 from u1;
ERROR HY000: Cannot revoke role 'r1' from: 'u1'@'%'
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
select * from mysql.roles_mapping;
Host User Role Admin_option
localhost root r1 Y
@ -30,8 +30,8 @@ grant r1 to u1;
grant r1 to u1;
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT r1 TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
GRANT `r1` TO `u1`@`%`
select * from mysql.roles_mapping;
Host User Role Admin_option
% u1 r1 N
@ -39,7 +39,7 @@ localhost root r1 Y
drop role r1;
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
select * from mysql.roles_mapping;
Host User Role Admin_option
create role r1;

View file

@ -26,8 +26,8 @@ ERROR HY000: Cannot grant role 'role10' to: 'role2'
connect foo, localhost, foo;
show grants;
Grants for foo@localhost
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT role10 TO 'foo'@'localhost'
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT `role10` TO `foo`@`localhost`
select * from information_schema.applicable_roles;
GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT
foo@localhost role10 NO NO
@ -56,27 +56,27 @@ count(*)
22
show grants;
Grants for foo@localhost
GRANT SELECT ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT ON *.* TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
select * from information_schema.enabled_roles;
ROLE_NAME
role1
@ -114,28 +114,28 @@ count(*)
22
show grants;
Grants for foo@localhost
GRANT SELECT ON `mysql`.* TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT ON `mysql`.* TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
connection default;
revoke select on mysql.* from role1;
show status like 'debug%';
@ -157,28 +157,28 @@ count(*)
22
show grants;
Grants for foo@localhost
GRANT SELECT ON `mysql`.`roles_mapping` TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT ON `mysql`.`roles_mapping` TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
connection default;
revoke select on mysql.roles_mapping from role1;
show status like 'debug%';
@ -202,28 +202,28 @@ count(concat(User))
22
show grants;
Grants for foo@localhost
GRANT SELECT (User) ON `mysql`.`roles_mapping` TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT (User) ON `mysql`.`roles_mapping` TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
connection default;
grant select(Host) on mysql.roles_mapping to role3;
show status like 'debug%';
@ -236,29 +236,29 @@ count(concat(User,Host))
22
show grants;
Grants for foo@localhost
GRANT SELECT (Host) ON `mysql`.`roles_mapping` TO 'role3'
GRANT SELECT (User) ON `mysql`.`roles_mapping` TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT (Host) ON `mysql`.`roles_mapping` TO `role3`
GRANT SELECT (User) ON `mysql`.`roles_mapping` TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
connection default;
revoke select(User) on mysql.roles_mapping from role1;
show status like 'debug%';

View file

@ -30,8 +30,8 @@ ERROR HY000: Cannot grant role 'role10' to: 'role2'
connect foo, localhost, foo;
show grants;
Grants for foo@localhost
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT role10 TO 'foo'@'localhost'
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT `role10` TO `foo`@`localhost`
select * from information_schema.applicable_roles;
GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT
foo@localhost role10 NO NO
@ -70,27 +70,27 @@ count(*)
22
show grants;
Grants for foo@localhost
GRANT SELECT ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT ON *.* TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
select * from information_schema.enabled_roles;
ROLE_NAME
role1
@ -138,28 +138,28 @@ count(*)
22
show grants;
Grants for foo@localhost
GRANT SELECT ON `mysql`.* TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT ON `mysql`.* TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
connection default;
revoke select on mysql.* from role1;
show status like 'debug%';
@ -191,28 +191,28 @@ count(*)
22
show grants;
Grants for foo@localhost
GRANT SELECT ON `mysql`.`roles_mapping` TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT ON `mysql`.`roles_mapping` TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
connection default;
revoke select on mysql.roles_mapping from role1;
show status like 'debug%';
@ -246,28 +246,28 @@ count(concat(User))
22
show grants;
Grants for foo@localhost
GRANT SELECT (User) ON `mysql`.`roles_mapping` TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT (User) ON `mysql`.`roles_mapping` TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
connection default;
grant select(Host) on mysql.roles_mapping to role3;
show status like 'debug%';
@ -285,29 +285,29 @@ count(concat(User,Host))
22
show grants;
Grants for foo@localhost
GRANT SELECT (Host) ON `mysql`.`roles_mapping` TO 'role3'
GRANT SELECT (User) ON `mysql`.`roles_mapping` TO 'role1'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role10'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role5'
GRANT USAGE ON *.* TO 'role6'
GRANT USAGE ON *.* TO 'role7'
GRANT USAGE ON *.* TO 'role9'
GRANT role1 TO 'role2'
GRANT role10 TO 'foo'@'localhost'
GRANT role2 TO 'role4'
GRANT role2 TO 'role5'
GRANT role3 TO 'role5'
GRANT role4 TO 'role6'
GRANT role5 TO 'role6'
GRANT role5 TO 'role7'
GRANT role6 TO 'role9'
GRANT role7 TO 'role9'
GRANT role9 TO 'role10'
GRANT SELECT (Host) ON `mysql`.`roles_mapping` TO `role3`
GRANT SELECT (User) ON `mysql`.`roles_mapping` TO `role1`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role10`
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT USAGE ON *.* TO `role3`
GRANT USAGE ON *.* TO `role4`
GRANT USAGE ON *.* TO `role5`
GRANT USAGE ON *.* TO `role6`
GRANT USAGE ON *.* TO `role7`
GRANT USAGE ON *.* TO `role9`
GRANT `role10` TO `foo`@`localhost`
GRANT `role1` TO `role2`
GRANT `role2` TO `role4`
GRANT `role2` TO `role5`
GRANT `role3` TO `role5`
GRANT `role4` TO `role6`
GRANT `role5` TO `role6`
GRANT `role5` TO `role7`
GRANT `role6` TO `role9`
GRANT `role7` TO `role9`
GRANT `role9` TO `role10`
connection default;
revoke select(User) on mysql.roles_mapping from role1;
show status like 'debug%';

View file

@ -10,18 +10,18 @@ grant r1 to u1;
grant r4 to r1;
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT r1 TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
GRANT `r1` TO `u1`@`%`
show grants for r1;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO 'r4'
GRANT r2 TO 'r1'
GRANT r3 TO 'r2'
GRANT r4 TO 'r1'
GRANT r4 TO 'r3'
GRANT USAGE ON *.* TO `r1`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT USAGE ON *.* TO `r4`
GRANT `r2` TO `r1`
GRANT `r3` TO `r2`
GRANT `r4` TO `r1`
GRANT `r4` TO `r3`
grant SELECT on *.* to u1;
grant INSERT on mysql.* to r1;
grant DELETE on mysql.roles_mapping to r2;
@ -38,146 +38,146 @@ grant execute on procedure mysql.test_proc to r3;
grant execute on mysql.* to r4;
show grants for r1;
Grants for r1
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT EXECUTE ON `mysql`.* TO 'r4'
GRANT INSERT ON `mysql`.* TO 'r1'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO 'r4'
GRANT r2 TO 'r1'
GRANT r3 TO 'r2'
GRANT r4 TO 'r1'
GRANT r4 TO 'r3'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `r2`
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT EXECUTE ON `mysql`.* TO `r4`
GRANT INSERT ON `mysql`.* TO `r1`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r1`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT USAGE ON *.* TO `r4`
GRANT `r2` TO `r1`
GRANT `r3` TO `r2`
GRANT `r4` TO `r1`
GRANT `r4` TO `r3`
show grants for r2;
Grants for r2
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT EXECUTE ON `mysql`.* TO 'r4'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO 'r4'
GRANT r3 TO 'r2'
GRANT r4 TO 'r3'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `r2`
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT EXECUTE ON `mysql`.* TO `r4`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT USAGE ON *.* TO `r4`
GRANT `r3` TO `r2`
GRANT `r4` TO `r3`
show grants for r3;
Grants for r3
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT EXECUTE ON `mysql`.* TO 'r4'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO 'r4'
GRANT r4 TO 'r3'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT EXECUTE ON `mysql`.* TO `r4`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r3`
GRANT USAGE ON *.* TO `r4`
GRANT `r4` TO `r3`
show grants for r4;
Grants for r4
GRANT EXECUTE ON `mysql`.* TO 'r4'
GRANT USAGE ON *.* TO 'r4'
GRANT EXECUTE ON `mysql`.* TO `r4`
GRANT USAGE ON *.* TO `r4`
revoke all privileges, grant option from r4;
show grants for r1;
Grants for r1
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT INSERT ON `mysql`.* TO 'r1'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO 'r4'
GRANT r2 TO 'r1'
GRANT r3 TO 'r2'
GRANT r4 TO 'r1'
GRANT r4 TO 'r3'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `r2`
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT INSERT ON `mysql`.* TO `r1`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r1`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT USAGE ON *.* TO `r4`
GRANT `r2` TO `r1`
GRANT `r3` TO `r2`
GRANT `r4` TO `r1`
GRANT `r4` TO `r3`
show grants for r2;
Grants for r2
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO 'r4'
GRANT r3 TO 'r2'
GRANT r4 TO 'r3'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `r2`
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT USAGE ON *.* TO `r4`
GRANT `r3` TO `r2`
GRANT `r4` TO `r3`
show grants for r3;
Grants for r3
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'r3'
GRANT UPDATE ON `mysql`.`user` TO 'r3'
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO 'r4'
GRANT r4 TO 'r3'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `r3`
GRANT UPDATE ON `mysql`.`user` TO `r3`
GRANT USAGE ON *.* TO `r3`
GRANT USAGE ON *.* TO `r4`
GRANT `r4` TO `r3`
show grants for r4;
Grants for r4
GRANT USAGE ON *.* TO 'r4'
GRANT USAGE ON *.* TO `r4`
revoke all privileges, grant option from r3;
show grants for r1;
Grants for r1
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2'
GRANT INSERT ON `mysql`.* TO 'r1'
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO 'r4'
GRANT r2 TO 'r1'
GRANT r3 TO 'r2'
GRANT r4 TO 'r1'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `r2`
GRANT INSERT ON `mysql`.* TO `r1`
GRANT USAGE ON *.* TO `r1`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT USAGE ON *.* TO `r4`
GRANT `r2` TO `r1`
GRANT `r3` TO `r2`
GRANT `r4` TO `r1`
show grants for r2;
Grants for r2
GRANT DELETE ON `mysql`.`roles_mapping` TO 'r2'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'r2'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r3'
GRANT r3 TO 'r2'
GRANT DELETE ON `mysql`.`roles_mapping` TO `r2`
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `r2`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r3`
GRANT `r3` TO `r2`
show grants for r3;
Grants for r3
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO `r3`
show grants for r4;
Grants for r4
GRANT USAGE ON *.* TO 'r4'
GRANT USAGE ON *.* TO `r4`
revoke all privileges, grant option from r2;
show grants for r1;
Grants for r1
GRANT INSERT ON `mysql`.* TO 'r1'
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO 'r4'
GRANT r2 TO 'r1'
GRANT r4 TO 'r1'
GRANT INSERT ON `mysql`.* TO `r1`
GRANT USAGE ON *.* TO `r1`
GRANT USAGE ON *.* TO `r2`
GRANT USAGE ON *.* TO `r4`
GRANT `r2` TO `r1`
GRANT `r4` TO `r1`
show grants for r2;
Grants for r2
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO `r2`
show grants for r3;
Grants for r3
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO `r3`
show grants for r4;
Grants for r4
GRANT USAGE ON *.* TO 'r4'
GRANT USAGE ON *.* TO `r4`
revoke all privileges, grant option from r1;
show grants for r1;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
show grants for r2;
Grants for r2
GRANT USAGE ON *.* TO 'r2'
GRANT USAGE ON *.* TO `r2`
show grants for r3;
Grants for r3
GRANT USAGE ON *.* TO 'r3'
GRANT USAGE ON *.* TO `r3`
show grants for r4;
Grants for r4
GRANT USAGE ON *.* TO 'r4'
GRANT USAGE ON *.* TO `r4`
revoke all privileges, grant option from u1;
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
drop function mysql.test_func;
drop procedure mysql.test_proc;
show grants for r1;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
drop role r1, r2, r3, r4;
drop user u1;

View file

@ -21,8 +21,8 @@ grant select on secret_db.* to test_role;
grant test_role to test_user;
show grants for test_user;
Grants for test_user@%
GRANT test_role TO 'test_user'@'%'
GRANT USAGE ON *.* TO 'test_user'@'%'
GRANT `test_role` TO `test_user`@`%`
GRANT USAGE ON *.* TO `test_user`@`%`
#
# Now test the UPPER case role.
#
@ -30,9 +30,9 @@ grant test_ROLE to test_user;
grant insert on secret_db.t1 to test_ROLE;
show grants for test_user;
Grants for test_user@%
GRANT test_role TO 'test_user'@'%'
GRANT test_ROLE TO 'test_user'@'%'
GRANT USAGE ON *.* TO 'test_user'@'%'
GRANT `test_role` TO `test_user`@`%`
GRANT `test_ROLE` TO `test_user`@`%`
GRANT USAGE ON *.* TO `test_user`@`%`
connect test_user,localhost,test_user;
#
# Test users privileges when interacting with those roles;

View file

@ -7,14 +7,14 @@ grant role2 to role1;
set role role1;
show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT EXECUTE ON `test`.* TO 'role2'
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT EXECUTE ON `test`.* TO `role2`
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT role1 TO 'root'@'localhost' WITH ADMIN OPTION
GRANT role2 TO 'role1'
GRANT role2 TO 'root'@'localhost' WITH ADMIN OPTION
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT `role1` TO `root`@`localhost` WITH ADMIN OPTION
GRANT `role2` TO `role1`
GRANT `role2` TO `root`@`localhost` WITH ADMIN OPTION
create definer=current_user procedure pcu() select current_user;
create definer=root@localhost procedure pu() select "root@localhost";
create definer=current_role procedure pcr() select current_role;
@ -39,14 +39,14 @@ connection slave;
set role role1;
show grants;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT EXECUTE ON `test`.* TO 'role2'
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT EXECUTE ON `test`.* TO `role2`
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT role1 TO 'root'@'localhost' WITH ADMIN OPTION
GRANT role2 TO 'role1'
GRANT role2 TO 'root'@'localhost' WITH ADMIN OPTION
GRANT USAGE ON *.* TO `role1`
GRANT USAGE ON *.* TO `role2`
GRANT `role1` TO `root`@`localhost` WITH ADMIN OPTION
GRANT `role2` TO `role1`
GRANT `role2` TO `root`@`localhost` WITH ADMIN OPTION
show create procedure pcu;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
pcu STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `pcu`()

View file

@ -56,9 +56,9 @@ drop role role2;
connection foo;
show grants;
Grants for foo@localhost
GRANT role1 TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO 'role1'
GRANT `role1` TO `foo`@`localhost`
GRANT USAGE ON *.* TO `foo`@`localhost`
GRANT USAGE ON *.* TO `role1`
select * from information_schema.enabled_roles;
ROLE_NAME
role1
@ -112,7 +112,7 @@ select a from mysqltest1.t2;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't2'
show grants;
Grants for foo@localhost
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT USAGE ON *.* TO `foo`@`localhost`
select * from information_schema.enabled_roles;
ROLE_NAME
NULL

View file

@ -4,8 +4,8 @@ grant select on *.* to test_role;
grant test_role to test_user@localhost;
show grants;
Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
set default role test_role;
select user, host, default_role from mysql.user;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user'
@ -14,9 +14,9 @@ User Host default_role
test_user localhost test_role
show grants;
Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT SELECT ON *.* TO `test_role`
select user, host, default_role from mysql.user where user='test_user';
User Host default_role
test_user localhost test_role

View file

@ -18,9 +18,9 @@ ERROR OP000: Invalid role specification `role_b`
set default role role_b for user_b@localhost;
show grants;
Grants for user_a@localhost
GRANT role_a TO 'user_a'@'localhost'
GRANT USAGE ON *.* TO 'user_a'@'localhost'
GRANT SELECT ON *.* TO 'role_a'
GRANT `role_a` TO `user_a`@`localhost`
GRANT USAGE ON *.* TO `user_a`@`localhost`
GRANT SELECT ON *.* TO `role_a`
select user, host, default_role from mysql.user where user like 'user_%';
User Host default_role
user_a localhost role_a
@ -39,17 +39,17 @@ set default role role_b for current_user;
ERROR OP000: Invalid role specification `role_b`
show grants;
Grants for user_b@localhost
GRANT role_b TO 'user_b'@'localhost'
GRANT USAGE ON *.* TO 'user_b'@'localhost'
GRANT INSERT, UPDATE ON *.* TO 'role_b'
GRANT `role_b` TO `user_b`@`localhost`
GRANT USAGE ON *.* TO `user_b`@`localhost`
GRANT INSERT, UPDATE ON *.* TO `role_b`
select user, host, default_role from mysql.user where user like 'user_%';
ERROR 42000: SELECT command denied to user 'user_b'@'localhost' for table 'user'
set default role NONE for user_a@localhost;
show grants;
Grants for user_a@localhost
GRANT role_a TO 'user_a'@'localhost'
GRANT USAGE ON *.* TO 'user_a'@'localhost'
GRANT INSERT, UPDATE ON *.* TO 'role_b'
GRANT `role_a` TO `user_a`@`localhost`
GRANT USAGE ON *.* TO `user_a`@`localhost`
GRANT INSERT, UPDATE ON *.* TO `role_b`
select user, host, default_role from mysql.user where user like 'user_%';
ERROR 42000: SELECT command denied to user 'user_a'@'localhost' for table 'user'
drop role role_a;

View file

@ -5,8 +5,8 @@ grant select on *.* to test_role;
grant test_role to test_user@localhost;
show grants;
Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
select user, host, default_role from mysql.user;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user'
set default role invalid_role;
@ -21,9 +21,9 @@ User Host default_role
test_user localhost test_role
show grants;
Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT SELECT ON *.* TO `test_role`
select user, host, default_role from mysql.user where user='test_user';
User Host default_role
test_user localhost test_role

View file

@ -5,8 +5,8 @@ grant test_role to test_user@localhost;
connect c1, localhost, test_user,,;
show grants;
Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
select user, host, default_role from mysql.user where user = 'test_user';
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user'
set default role test_role;
@ -20,9 +20,9 @@ test_user localhost test_role
connect c1, localhost, test_user,,;
show grants;
Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT SELECT ON *.* TO `test_role`
select user, host, default_role from mysql.user where user = 'test_user';
User Host default_role
test_user localhost test_role
@ -35,8 +35,8 @@ test_user localhost
connect c1, localhost, test_user,,;
show grants;
Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
select user, host, default_role from mysql.user where user = 'test_user';
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'user'
disconnect c1;
@ -48,9 +48,9 @@ set default role test_role for test_user@localhost;
connect c1, localhost, test_user,,;
show grants;
Grants for test_user@localhost
GRANT test_role TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO 'test_role'
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT SELECT ON *.* TO `test_role`
select user, host, default_role from mysql.user where user = 'test_user';
User Host default_role
test_user localhost test_role

View file

@ -18,10 +18,10 @@ create role admin;
grant simple to admin;
show grants for admin;
Grants for admin
GRANT simple TO 'admin'
GRANT USAGE ON *.* TO 'admin'
GRANT USAGE ON *.* TO 'simple'
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO 'simple'
GRANT `simple` TO `admin`
GRANT USAGE ON *.* TO `admin`
GRANT USAGE ON *.* TO `simple`
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO `simple`
#
# Finally, we give the admin all the available privileges for the db.
#
@ -37,13 +37,13 @@ ERROR 42000: Access denied for user 'foo'@'%' to database 't'
set role admin;
show grants;
Grants for foo@%
GRANT admin TO 'foo'@'%'
GRANT USAGE ON *.* TO 'foo'@'%'
GRANT simple TO 'admin'
GRANT USAGE ON *.* TO 'admin'
GRANT ALL PRIVILEGES ON `t`.* TO 'admin'
GRANT USAGE ON *.* TO 'simple'
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO 'simple'
GRANT `admin` TO `foo`@`%`
GRANT USAGE ON *.* TO `foo`@`%`
GRANT `simple` TO `admin`
GRANT USAGE ON *.* TO `admin`
GRANT ALL PRIVILEGES ON `t`.* TO `admin`
GRANT USAGE ON *.* TO `simple`
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO `simple`
create database t;
drop database t;
connection default;

View file

@ -35,16 +35,16 @@ GRANT `client` TO `usertestjohn`@`%`;
#
SHOW GRANTS FOR `john`@`%`;
Grants for john@%
GRANT client TO 'john'@'%'
GRANT USAGE ON *.* TO 'john'@'%'
GRANT `client` TO `john`@`%`
GRANT USAGE ON *.* TO `john`@`%`
SHOW GRANTS FOR `usertestjohn`@`%`;
Grants for usertestjohn@%
GRANT client TO 'usertestjohn'@'%'
GRANT USAGE ON *.* TO 'usertestjohn'@'%'
GRANT `client` TO `usertestjohn`@`%`
GRANT USAGE ON *.* TO `usertestjohn`@`%`
SHOW GRANTS FOR `client`;
Grants for client
GRANT USAGE ON *.* TO 'client'
GRANT SELECT ON `bug_db`.`t0` TO 'client'
GRANT USAGE ON *.* TO `client`
GRANT SELECT ON `bug_db`.`t0` TO `client`
show databases;
Database
bug_db
@ -84,10 +84,10 @@ information_schema
test
show grants;
Grants for usertestjohn@%
GRANT client TO 'usertestjohn'@'%'
GRANT USAGE ON *.* TO 'usertestjohn'@'%'
GRANT USAGE ON *.* TO 'client'
GRANT SELECT ON `bug_db`.`t0` TO 'client'
GRANT `client` TO `usertestjohn`@`%`
GRANT USAGE ON *.* TO `usertestjohn`@`%`
GRANT USAGE ON *.* TO `client`
GRANT SELECT ON `bug_db`.`t0` TO `client`
use bug_db;
#
# Cleanup

View file

@ -67,17 +67,17 @@ set role test_role1;
delete from mysql.user where user='no such user';
show grants;
Grants for test_user@localhost
GRANT DELETE ON `mysql`.* TO 'test_role4'
GRANT SELECT ON `mysql`.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role3'
GRANT USAGE ON *.* TO 'test_role4'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT test_role3 TO 'test_role2'
GRANT test_role4 TO 'test_role3'
GRANT DELETE ON `mysql`.* TO `test_role4`
GRANT SELECT ON `mysql`.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role3`
GRANT USAGE ON *.* TO `test_role4`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
GRANT `test_role2` TO `test_user`@`localhost`
GRANT `test_role3` TO `test_role2`
GRANT `test_role4` TO `test_role3`
drop user test_user@localhost;
drop role test_role1, test_role2, test_role3, test_role4;

View file

@ -25,14 +25,14 @@ select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT r_crt TO 'test_user'@'localhost'
GRANT r_del TO 'test_user'@'localhost'
GRANT r_drp TO 'test_user'@'localhost'
GRANT r_ins TO 'test_user'@'localhost'
GRANT r_rld TO 'test_user'@'localhost'
GRANT r_sel TO 'test_user'@'localhost'
GRANT r_upd TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `r_crt` TO `test_user`@`localhost`
GRANT `r_del` TO `test_user`@`localhost`
GRANT `r_drp` TO `test_user`@`localhost`
GRANT `r_ins` TO `test_user`@`localhost`
GRANT `r_rld` TO `test_user`@`localhost`
GRANT `r_sel` TO `test_user`@`localhost`
GRANT `r_upd` TO `test_user`@`localhost`
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
@ -42,15 +42,15 @@ current_user() current_role()
test_user@localhost r_sel
show grants;
Grants for test_user@localhost
GRANT SELECT ON *.* TO 'r_sel'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT r_crt TO 'test_user'@'localhost'
GRANT r_del TO 'test_user'@'localhost'
GRANT r_drp TO 'test_user'@'localhost'
GRANT r_ins TO 'test_user'@'localhost'
GRANT r_rld TO 'test_user'@'localhost'
GRANT r_sel TO 'test_user'@'localhost'
GRANT r_upd TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO `r_sel`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `r_crt` TO `test_user`@`localhost`
GRANT `r_del` TO `test_user`@`localhost`
GRANT `r_drp` TO `test_user`@`localhost`
GRANT `r_ins` TO `test_user`@`localhost`
GRANT `r_rld` TO `test_user`@`localhost`
GRANT `r_sel` TO `test_user`@`localhost`
GRANT `r_upd` TO `test_user`@`localhost`
select * from mysql.roles_mapping;
Host User Role Admin_option
localhost root r_crt Y
@ -73,15 +73,15 @@ current_user() current_role()
test_user@localhost r_ins
show grants;
Grants for test_user@localhost
GRANT INSERT ON *.* TO 'r_ins'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT r_crt TO 'test_user'@'localhost'
GRANT r_del TO 'test_user'@'localhost'
GRANT r_drp TO 'test_user'@'localhost'
GRANT r_ins TO 'test_user'@'localhost'
GRANT r_rld TO 'test_user'@'localhost'
GRANT r_sel TO 'test_user'@'localhost'
GRANT r_upd TO 'test_user'@'localhost'
GRANT INSERT ON *.* TO `r_ins`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `r_crt` TO `test_user`@`localhost`
GRANT `r_del` TO `test_user`@`localhost`
GRANT `r_drp` TO `test_user`@`localhost`
GRANT `r_ins` TO `test_user`@`localhost`
GRANT `r_rld` TO `test_user`@`localhost`
GRANT `r_sel` TO `test_user`@`localhost`
GRANT `r_upd` TO `test_user`@`localhost`
select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
insert into mysql.roles_mapping values ('', 'r_sel', 'r_rld', 'N');

View file

@ -25,8 +25,8 @@ select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
@ -36,35 +36,35 @@ current_user() current_role()
test_user@localhost test_role1
show grants;
Grants for test_user@localhost
GRANT SELECT ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT SELECT ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
select * from mysql.roles_mapping where Host='';
Host User Role Admin_option
test_role1 test_role2 N
show grants;
Grants for test_user@localhost
GRANT SELECT ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT SELECT ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
set role none;
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
set role test_role2;
ERROR OP000: Invalid role specification `test_role2`
select current_user(), current_role();
@ -72,43 +72,43 @@ current_user() current_role()
test_user@localhost NULL
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
set role test_role1;
select current_user(), current_role();
current_user() current_role()
test_user@localhost test_role1
show grants;
Grants for test_user@localhost
GRANT SELECT ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT SELECT ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
select * from mysql.roles_mapping where Host='';
Host User Role Admin_option
test_role1 test_role2 N
show grants;
Grants for test_user@localhost
GRANT SELECT ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT SELECT ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
set role none;
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
delete from mysql.user where user='test_role1';

View file

@ -31,9 +31,9 @@ grant execute on procedure mysql.test_proc to test_role2;
grant execute on mysql.* to test_role3;
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role3 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role3` TO `test_user`@`localhost`
use mysql;
ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql'
select current_user(), current_role();
@ -53,23 +53,23 @@ test_func('AABBCCDD')
Test string: AABBCCDD
show grants;
Grants for test_user@localhost
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO 'test_role2'
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT test_role3 TO 'test_user'@'localhost'
GRANT EXECUTE ON FUNCTION `mysql`.`test_func` TO `test_role2`
GRANT EXECUTE ON PROCEDURE `mysql`.`test_proc` TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
GRANT `test_role3` TO `test_user`@`localhost`
set role none;
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role3 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role3` TO `test_user`@`localhost`
call test_proc(@a);
ERROR 42000: execute command denied to user 'test_user'@'localhost' for routine 'mysql.test_proc'
SELECT test_func('AABBCCDD');
@ -80,11 +80,11 @@ current_user() current_role()
test_user@localhost test_role3
show grants;
Grants for test_user@localhost
GRANT EXECUTE ON `mysql`.* TO 'test_role3'
GRANT USAGE ON *.* TO 'test_role3'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role3 TO 'test_user'@'localhost'
GRANT EXECUTE ON `mysql`.* TO `test_role3`
GRANT USAGE ON *.* TO `test_role3`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role3` TO `test_user`@`localhost`
call test_proc(@a);
SELECT @a;
@a

View file

@ -17,8 +17,8 @@ select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
@ -28,9 +28,9 @@ current_user() current_role()
test_user@localhost test_role1
show grants;
Grants for test_user@localhost
GRANT SELECT ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT SELECT ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
select * from mysql.roles_mapping;
Host User Role Admin_option
localhost root test_role1 Y
@ -52,7 +52,7 @@ current_user
user1@%
show grants;
Grants for user1@%
GRANT USAGE ON *.* TO 'user1'@'%'
GRANT USAGE ON *.* TO `user1`@`%`
set role none;
connection default;
drop user user1;

View file

@ -19,8 +19,8 @@ select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
@ -30,12 +30,12 @@ current_user() current_role()
test_user@localhost test_role1
show grants;
Grants for test_user@localhost
GRANT SELECT (Role) ON `mysql`.`roles_mapping` TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT SELECT (Role) ON `mysql`.`roles_mapping` TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for column 'Host' in table 'roles_mapping'
select Role from mysql.roles_mapping;
@ -46,12 +46,12 @@ test_role2
test_role2
show grants;
Grants for test_user@localhost
GRANT SELECT (Role) ON `mysql`.`roles_mapping` TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT SELECT (Role) ON `mysql`.`roles_mapping` TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
use mysql;
set role none;
select current_user(), current_role();

View file

@ -19,8 +19,8 @@ select * from mysql.roles_mapping;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table 'roles_mapping'
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
@ -30,12 +30,12 @@ current_user() current_role()
test_user@localhost test_role1
show grants;
Grants for test_user@localhost
GRANT SELECT ON `mysql`.`roles_mapping` TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT SELECT ON `mysql`.`roles_mapping` TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
select * from mysql.roles_mapping;
Host User Role Admin_option
test_role1 test_role2 N
@ -44,12 +44,12 @@ localhost root test_role2 Y
localhost test_user test_role1 N
show grants;
Grants for test_user@localhost
GRANT SELECT ON `mysql`.`roles_mapping` TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT SELECT ON `mysql`.`roles_mapping` TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
use mysql;
set role none;
select current_user(), current_role();

View file

@ -34,9 +34,9 @@ test_user@localhost test_role1 NO NO
test_user@localhost test_role2 NO NO
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
select current_user(), current_role();
current_user() current_role()
test_user@localhost NULL
@ -50,13 +50,13 @@ current_user() current_role()
test_user@localhost test_role1
show grants;
Grants for test_user@localhost
GRANT SELECT ON `mysql`.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_role1'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT SELECT ON `mysql`.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_role1`
GRANT `test_role2` TO `test_user`@`localhost`
set role none;
select * from information_schema.enabled_roles;
ROLE_NAME
@ -66,28 +66,28 @@ current_user() current_role()
test_user@localhost NULL
show grants;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
show grants for test_user@localhost;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
show grants for test_role1;
ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql'
show grants for test_role2;
ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql'
show grants for CURRENT_USER;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
show grants for CURRENT_USER();
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
show grants for CURRENT_ROLE;
ERROR 42000: There is no such grant defined for user 'test_user' on host 'localhost'
show grants for CURRENT_ROLE();
@ -101,44 +101,44 @@ current_user() current_role()
test_user@localhost test_role2
show grants;
Grants for test_user@localhost
GRANT SELECT ON `mysql`.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT SELECT ON `mysql`.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role2`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
show grants for test_user@localhost;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
show grants for test_role1;
Grants for test_role1
GRANT SELECT ON `mysql`.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role1'
GRANT USAGE ON *.* TO 'test_role2'
GRANT test_role2 TO 'test_role1'
GRANT SELECT ON `mysql`.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role1`
GRANT USAGE ON *.* TO `test_role2`
GRANT `test_role2` TO `test_role1`
show grants for test_role2;
Grants for test_role2
GRANT SELECT ON `mysql`.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role2'
GRANT SELECT ON `mysql`.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role2`
show grants for CURRENT_USER;
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
show grants for CURRENT_USER();
Grants for test_user@localhost
GRANT USAGE ON *.* TO 'test_user'@'localhost'
GRANT test_role1 TO 'test_user'@'localhost'
GRANT test_role2 TO 'test_user'@'localhost'
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT `test_role1` TO `test_user`@`localhost`
GRANT `test_role2` TO `test_user`@`localhost`
show grants for CURRENT_ROLE;
Grants for test_role2
GRANT SELECT ON `mysql`.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role2'
GRANT SELECT ON `mysql`.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role2`
show grants for CURRENT_ROLE();
Grants for test_role2
GRANT SELECT ON `mysql`.* TO 'test_role2'
GRANT USAGE ON *.* TO 'test_role2'
GRANT SELECT ON `mysql`.* TO `test_role2`
GRANT USAGE ON *.* TO `test_role2`
drop user 'test_user'@'localhost';
revoke select on mysql.* from test_role2;
drop role test_role1;

View file

@ -6,10 +6,10 @@ create role r1;
# On master SHOW GRANTS work both for the user and the role:
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
show grants for r1;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
#
connection slave;
#
@ -27,30 +27,30 @@ root@localhost r1 YES NO
# Check show grants for the new user.
show grants for u1;
Grants for u1@%
GRANT USAGE ON *.* TO 'u1'@'%'
GRANT USAGE ON *.* TO `u1`@`%`
#
# Check show grants for the new role.
show grants for r1;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
#
# Check if flushing privileges preserves the state.
flush privileges;
show grants for r1;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
#
# Check SHOW GRANTS after setting the role.
set role r1;
show grants;
Grants for root@localhost
GRANT r1 TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT `r1` TO `root`@`localhost` WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
show grants for r1;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
GRANT USAGE ON *.* TO `r1`
connection master;
drop role r1;
drop user u1;