Debian Codegraph @

mysql-test/suite/roles/show_grants.result

raw
1 create user test_user@localhost;
2 create role test_role1;
3 create role test_role2;
4 grant test_role1 to test_user@localhost;
5 grant test_role2 to test_user@localhost;
6 grant test_role2 to test_role1;
7 select user, host from mysql.user where user not like 'root';
8 User Host
9 mariadb.sys localhost
10 test_role1
11 test_role2
12 test_user localhost
13 select * from mysql.roles_mapping;
14 Host User Role Admin_option
15 test_role1 test_role2 N
16 localhost root test_role1 Y
17 localhost root test_role2 Y
18 localhost test_user test_role1 N
19 localhost test_user test_role2 N
20 select user, host from mysql.db;
21 user host
22 grant select on mysql.* to test_role2;
23 flush privileges;
24 select * from information_schema.applicable_roles;
25 GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT
26 root@localhost test_role1 YES NO
27 root@localhost test_role2 YES NO
28 test_role1 test_role2 NO NULL
29 select * from information_schema.applicable_roles;
30 GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT
31 test_role1 test_role2 NO NULL
32 test_user@localhost test_role1 NO NO
33 test_user@localhost test_role2 NO NO
34 show grants;
35 Grants for test_user@localhost
36 GRANT USAGE ON *.* TO `test_user`@`localhost`
37 GRANT `test_role1` TO `test_user`@`localhost`
38 GRANT `test_role2` TO `test_user`@`localhost`
39 select current_user(), current_role();
40 current_user() current_role()
41 test_user@localhost NULL
42 set role test_role1;
43 select * from information_schema.enabled_roles;
44 ROLE_NAME
45 test_role1
46 test_role2
47 select current_user(), current_role();
48 current_user() current_role()
49 test_user@localhost test_role1
50 show grants;
51 Grants for test_user@localhost
52 GRANT SELECT ON `mysql`.* TO `test_role2`
53 GRANT USAGE ON *.* TO `test_role1`
54 GRANT USAGE ON *.* TO `test_role2`
55 GRANT USAGE ON *.* TO `test_user`@`localhost`
56 GRANT `test_role1` TO `test_user`@`localhost`
57 GRANT `test_role2` TO `test_role1`
58 GRANT `test_role2` TO `test_user`@`localhost`
59 set role none;
60 select * from information_schema.enabled_roles;
61 ROLE_NAME
62 NULL
63 select current_user(), current_role();
64 current_user() current_role()
65 test_user@localhost NULL
66 show grants;
67 Grants for test_user@localhost
68 GRANT USAGE ON *.* TO `test_user`@`localhost`
69 GRANT `test_role1` TO `test_user`@`localhost`
70 GRANT `test_role2` TO `test_user`@`localhost`
71 show grants for test_user@localhost;
72 Grants for test_user@localhost
73 GRANT USAGE ON *.* TO `test_user`@`localhost`
74 GRANT `test_role1` TO `test_user`@`localhost`
75 GRANT `test_role2` TO `test_user`@`localhost`
76 show grants for test_role1;
77 ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql'
78 show grants for test_role2;
79 ERROR 42000: Access denied for user 'test_user'@'localhost' to database 'mysql'
80 show grants for CURRENT_USER;
81 Grants for test_user@localhost
82 GRANT USAGE ON *.* TO `test_user`@`localhost`
83 GRANT `test_role1` TO `test_user`@`localhost`
84 GRANT `test_role2` TO `test_user`@`localhost`
85 show grants for CURRENT_USER();
86 Grants for test_user@localhost
87 GRANT USAGE ON *.* TO `test_user`@`localhost`
88 GRANT `test_role1` TO `test_user`@`localhost`
89 GRANT `test_role2` TO `test_user`@`localhost`
90 show grants for CURRENT_ROLE;
91 ERROR 42000: There is no such grant defined for user 'test_user' on host 'localhost'
92 show grants for CURRENT_ROLE();
93 ERROR 42000: There is no such grant defined for user 'test_user' on host 'localhost'
94 set role test_role2;
95 select * from information_schema.enabled_roles;
96 ROLE_NAME
97 test_role2
98 select current_user(), current_role();
99 current_user() current_role()
100 test_user@localhost test_role2
101 show grants;
102 Grants for test_user@localhost
103 GRANT SELECT ON `mysql`.* TO `test_role2`
104 GRANT USAGE ON *.* TO `test_role2`
105 GRANT USAGE ON *.* TO `test_user`@`localhost`
106 GRANT `test_role1` TO `test_user`@`localhost`
107 GRANT `test_role2` TO `test_user`@`localhost`
108 show grants for test_user@localhost;
109 Grants for test_user@localhost
110 GRANT USAGE ON *.* TO `test_user`@`localhost`
111 GRANT `test_role1` TO `test_user`@`localhost`
112 GRANT `test_role2` TO `test_user`@`localhost`
113 show grants for test_role1;
114 Grants for test_role1
115 GRANT SELECT ON `mysql`.* TO `test_role2`
116 GRANT USAGE ON *.* TO `test_role1`
117 GRANT USAGE ON *.* TO `test_role2`
118 GRANT `test_role2` TO `test_role1`
119 show grants for test_role2;
120 Grants for test_role2
121 GRANT SELECT ON `mysql`.* TO `test_role2`
122 GRANT USAGE ON *.* TO `test_role2`
123 show grants for CURRENT_USER;
124 Grants for test_user@localhost
125 GRANT USAGE ON *.* TO `test_user`@`localhost`
126 GRANT `test_role1` TO `test_user`@`localhost`
127 GRANT `test_role2` TO `test_user`@`localhost`
128 show grants for CURRENT_USER();
129 Grants for test_user@localhost
130 GRANT USAGE ON *.* TO `test_user`@`localhost`
131 GRANT `test_role1` TO `test_user`@`localhost`
132 GRANT `test_role2` TO `test_user`@`localhost`
133 show grants for CURRENT_ROLE;
134 Grants for test_role2
135 GRANT SELECT ON `mysql`.* TO `test_role2`
136 GRANT USAGE ON *.* TO `test_role2`
137 show grants for CURRENT_ROLE();
138 Grants for test_role2
139 GRANT SELECT ON `mysql`.* TO `test_role2`
140 GRANT USAGE ON *.* TO `test_role2`
141 drop user 'test_user'@'localhost';
142 revoke select on mysql.* from test_role2;
143 drop role test_role1;
144 drop role test_role2;
145 delete from mysql.roles_mapping where Role='test_role1';
146 delete from mysql.roles_mapping where Role='test_role2';
147 flush privileges;
148 #
149 # MDEV-24289: show grants missing with grant option
150 #
151 create role anel;
152 GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel';
153 SHOW GRANTS for 'anel';
154 Grants for anel
155 GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO `anel`
156 create role MariaDB_admin;
157 GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION;
158 SHOW GRANTS for 'MariaDB_admin';
159 Grants for MariaDB_admin
160 GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO `MariaDB_admin` WITH GRANT OPTION
161 drop role MariaDB_admin;
162 drop role anel;