| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
create user u1; |
| 4 |
create role r1; |
| 5 |
# |
| 6 |
# On master SHOW GRANTS work both for the user and the role: |
| 7 |
show grants for u1; |
| 8 |
Grants for u1@% |
| 9 |
GRANT USAGE ON *.* TO `u1`@`%` |
| 10 |
show grants for r1; |
| 11 |
Grants for r1 |
| 12 |
GRANT USAGE ON *.* TO `r1` |
| 13 |
# |
| 14 |
connection slave; |
| 15 |
# |
| 16 |
# The role has been replicated, |
| 17 |
# it's visible in mysql.user and I_S: |
| 18 |
# |
| 19 |
select user, host, is_role from mysql.user where user in ('u1', 'r1'); |
| 20 |
User Host is_role |
| 21 |
r1 Y |
| 22 |
u1 % N |
| 23 |
select * from information_schema.applicable_roles; |
| 24 |
GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT |
| 25 |
root@localhost r1 YES NO |
| 26 |
# |
| 27 |
# Check show grants for the new user. |
| 28 |
show grants for u1; |
| 29 |
Grants for u1@% |
| 30 |
GRANT USAGE ON *.* TO `u1`@`%` |
| 31 |
# |
| 32 |
# Check show grants for the new role. |
| 33 |
show grants for r1; |
| 34 |
Grants for r1 |
| 35 |
GRANT USAGE ON *.* TO `r1` |
| 36 |
# |
| 37 |
# Check if flushing privileges preserves the state. |
| 38 |
flush privileges; |
| 39 |
show grants for r1; |
| 40 |
Grants for r1 |
| 41 |
GRANT USAGE ON *.* TO `r1` |
| 42 |
# |
| 43 |
# Check SHOW GRANTS after setting the role. |
| 44 |
set role r1; |
| 45 |
show grants; |
| 46 |
Grants for root@localhost |
| 47 |
GRANT `r1` TO `root`@`localhost` WITH ADMIN OPTION |
| 48 |
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION |
| 49 |
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION |
| 50 |
GRANT USAGE ON *.* TO `r1` |
| 51 |
show grants for r1; |
| 52 |
Grants for r1 |
| 53 |
GRANT USAGE ON *.* TO `r1` |
| 54 |
connection master; |
| 55 |
drop role r1; |
| 56 |
drop user u1; |
| 57 |
connection slave; |
| 58 |
include/rpl_end.inc |