2013-10-18 21:17:49 +02:00
|
|
|
create user test_user@localhost;
|
|
|
|
create role test_role1;
|
2013-10-18 21:21:10 +02:00
|
|
|
grant test_role1 to test_user@localhost;
|
2013-10-18 21:17:49 +02:00
|
|
|
create role test_role2;
|
2013-10-18 21:21:10 +02:00
|
|
|
grant test_role2 to test_role1;
|
2013-10-18 05:52:04 +02:00
|
|
|
use mysql;
|
|
|
|
select * from roles_mapping;
|
2013-10-18 21:21:10 +02:00
|
|
|
Host User Role Admin_option
|
|
|
|
test_role1 test_role2 N
|
2013-10-18 21:27:07 +02:00
|
|
|
localhost root test_role1 Y
|
|
|
|
localhost root test_role2 Y
|
2013-10-18 21:21:10 +02:00
|
|
|
localhost test_user test_role1 N
|
2013-10-18 05:52:04 +02:00
|
|
|
rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost';
|
|
|
|
select user, host from user where user like 'test%';
|
|
|
|
user host
|
|
|
|
test_role1
|
|
|
|
test_role2
|
|
|
|
test_user_rm newhost
|
|
|
|
select * from roles_mapping;
|
2013-10-18 21:21:10 +02:00
|
|
|
Host User Role Admin_option
|
|
|
|
test_role1 test_role2 N
|
2013-10-18 21:27:07 +02:00
|
|
|
localhost root test_role1 Y
|
|
|
|
localhost root test_role2 Y
|
2013-10-18 21:21:10 +02:00
|
|
|
newhost test_user_rm test_role1 N
|
2013-10-18 05:52:04 +02:00
|
|
|
delete from mysql.roles_mapping;
|
|
|
|
delete from mysql.user where user like 'test%';
|
|
|
|
flush privileges;
|