@@ -19,7 +19,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
...
@@ -19,7 +19,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
grant role1 to foo@localhost with admin option;
grant role1 to foo@localhost with admin option;
grant role2 to foo@localhost;
grant role2 to foo@localhost;
grant role2 to role1;
grant role2 to role1;
grant role3 to role4 with admin option;
grant role4 to role3 with admin option;
grant select on *.* to foo@localhost with admin option;
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
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;
show grants for foo@localhost;
...
@@ -33,18 +33,18 @@ Grants for role1
...
@@ -33,18 +33,18 @@ Grants for role1
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT role2 TO 'role1'
GRANT role2 TO 'role1'
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role4 TO 'role3' WITH ADMIN OPTION
show grants for role4;
show grants for role4;
Grants for role4
Grants for role4
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role4'
GRANT role3 TO 'role4' WITH ADMIN OPTION
select * from mysql.roles_mapping;
select * from mysql.roles_mapping;
Host User Role Admin_option
Host User Role Admin_option
role1 role2 N
role1 role2 N
role1 role3 Y
role1 role3 Y
role4 role3 Y
role3 role4 Y
bar foo role6 Y
bar foo role6 Y
localhost foo role1 Y
localhost foo role1 Y
localhost foo role2 N
localhost foo role2 N
...
@@ -64,25 +64,26 @@ Grants for role1
...
@@ -64,25 +64,26 @@ Grants for role1
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT role2 TO 'role1'
GRANT role2 TO 'role1'
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role4 TO 'role3' WITH ADMIN OPTION
show grants for role4;
show grants for role4;
Grants for role4
Grants for role4
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role4'
GRANT role3 TO 'role4' WITH ADMIN OPTION
select * from information_schema.applicable_roles;
select * from information_schema.applicable_roles;
GRANTEE ROLE_NAME IS_GRANTABLE
GRANTEE ROLE_NAME IS_GRANTABLE
role1 role2 NO
role1 role2 NO
role1 role3 YES
role1 role3 YES
role4 role3 YES
role3 role4 YES
root@localhost role1 YES
root@localhost role1 YES
root@localhost role2 YES
root@localhost role2 YES
root@localhost role4 YES
root@localhost role4 YES
grant role2 to role1 with admin option;
grant role2 to role1 with admin option;
revoke role1 from foo@localhost;
revoke role1 from foo@localhost;
revoke admin option for role3 from role4;
revoke admin option for role4 from role3;
revoke admin option for role2 from foo@localhost;
revoke admin option for role2 from foo@localhost;
revoke admin option for role1 from root@localhost;
show grants for foo@localhost;
show grants for foo@localhost;
Grants for foo@localhost
Grants for foo@localhost
GRANT CREATE USER ON *.* TO 'foo'@'localhost'
GRANT CREATE USER ON *.* TO 'foo'@'localhost'
...
@@ -93,22 +94,22 @@ Grants for role1
...
@@ -93,22 +94,22 @@ Grants for role1
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT role2 TO 'role1' WITH ADMIN OPTION
GRANT role2 TO 'role1' WITH ADMIN OPTION
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role4 TO 'role3'
show grants for role4;
show grants for role4;
Grants for role4
Grants for role4
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role4'
GRANT role3 TO 'role4'
select * from mysql.roles_mapping;
select * from mysql.roles_mapping;
Host User Role Admin_option
Host User Role Admin_option
role1 role2 Y
role1 role2 Y
role1 role3 Y
role1 role3 Y
role4 role3 N
role3 role4 N
bar foo role6 Y
bar foo role6 Y
localhost foo role2 N
localhost foo role2 N
localhost foo role5 Y
localhost foo role5 Y
localhost root role1 Y
localhost root role1 N
localhost root role2 Y
localhost root role2 Y
localhost root role4 Y
localhost root role4 Y
flush privileges;
flush privileges;
...
@@ -122,20 +123,30 @@ Grants for role1
...
@@ -122,20 +123,30 @@ Grants for role1
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role1'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role2'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT role2 TO 'role1' WITH ADMIN OPTION
GRANT role2 TO 'role1' WITH ADMIN OPTION
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role3 TO 'role1' WITH ADMIN OPTION
GRANT role4 TO 'role3'
show grants for role4;
show grants for role4;
Grants for role4
Grants for role4
GRANT USAGE ON *.* TO 'role3'
GRANT USAGE ON *.* TO 'role4'
GRANT USAGE ON *.* TO 'role4'
GRANT role3 TO 'role4'
select * from information_schema.applicable_roles;
select * from information_schema.applicable_roles;
GRANTEE ROLE_NAME IS_GRANTABLE
GRANTEE ROLE_NAME IS_GRANTABLE
role1 role2 YES
role1 role2 YES
role1 role3 YES
role1 role3 YES
role4 role3 NO
role3 role4 NO
root@localhost role1 YES
root@localhost role1 NO
root@localhost role2 YES
root@localhost role2 YES
root@localhost role4 YES
root@localhost role4 YES
grant role1 to role4;
ERROR 28000: Access denied for user 'root'@'localhost'
grant role1 to role4 with admin option;
ERROR 28000: Access denied for user 'root'@'localhost'
grant role3 to role2;
revoke role3 from role2;
grant role4 to role2 with admin option;
revoke role2 from current_user;
revoke role4 from current_user;
grant role4 to current_user;
drop role role1, role2, role3, role4, role5, role6;
drop role role1, role2, role3, role4, role5, role6;