| 1 |
create user test_user@localhost; |
| 2 |
create role test_role1; |
| 3 |
grant test_role1 to test_user@localhost; |
| 4 |
create role test_role2; |
| 5 |
grant test_role2 to test_role1; |
| 6 |
use mysql; |
| 7 |
select * from roles_mapping; |
| 8 |
Host User Role Admin_option |
| 9 |
test_role1 test_role2 N |
| 10 |
localhost root test_role1 Y |
| 11 |
localhost root test_role2 Y |
| 12 |
localhost test_user test_role1 N |
| 13 |
rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost'; |
| 14 |
select user, host from user where user like 'test%'; |
| 15 |
User Host |
| 16 |
test_role1 |
| 17 |
test_role2 |
| 18 |
test_user_rm newhost |
| 19 |
select * from roles_mapping; |
| 20 |
Host User Role Admin_option |
| 21 |
test_role1 test_role2 N |
| 22 |
localhost root test_role1 Y |
| 23 |
localhost root test_role2 Y |
| 24 |
newhost test_user_rm test_role1 N |
| 25 |
delete from mysql.roles_mapping; |
| 26 |
delete from mysql.user where user like 'test%'; |
| 27 |
flush privileges; |
| 28 |
# |
| 29 |
# MDEV-29131 Assertion `status == 0' failed when renaming user after deleting table roles_mapping |
| 30 |
# |
| 31 |
create role r; |
| 32 |
rename table mysql.roles_mapping to test.t1; |
| 33 |
rename user current_user to a@a; |
| 34 |
rename user a@a to root@localhost; |
| 35 |
rename table test.t1 to mysql.roles_mapping; |
| 36 |
drop role r; |