2013-10-17 20:52:04 -07:00
|
|
|
|
|
|
|
#create a user with no privileges
|
2013-10-18 12:17:49 -07:00
|
|
|
create user test_user@localhost;
|
|
|
|
create role test_role1;
|
2013-10-18 12:19:37 -07:00
|
|
|
insert into mysql.roles_mapping values ('localhost', 'test_user', 'test_role1');
|
2013-10-18 12:17:49 -07:00
|
|
|
create role test_role2;
|
2013-10-18 12:19:37 -07:00
|
|
|
insert into mysql.roles_mapping values ('', 'test_role1', 'test_role2');
|
2013-10-17 20:52:04 -07:00
|
|
|
flush privileges;
|
|
|
|
|
|
|
|
use mysql;
|
2013-10-18 06:34:27 -07:00
|
|
|
--sorted_result
|
2013-10-17 20:52:04 -07:00
|
|
|
select * from roles_mapping;
|
|
|
|
|
|
|
|
#regular user rename
|
|
|
|
rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost';
|
2013-10-18 06:34:27 -07:00
|
|
|
--sorted_result
|
2013-10-17 20:52:04 -07:00
|
|
|
select user, host from user where user like 'test%';
|
2013-10-18 06:34:27 -07:00
|
|
|
--sorted_result
|
2013-10-17 20:52:04 -07:00
|
|
|
select * from roles_mapping;
|
|
|
|
|
2013-10-18 12:17:49 -07:00
|
|
|
######### role rename does not work yet
|
|
|
|
#rename user 'test_role2'@'' to 'test_role2_rm'@'';
|
|
|
|
#--sorted_result
|
|
|
|
#select user, host from user where user like 'test%';
|
|
|
|
#--sorted_result
|
|
|
|
#select * from roles_mapping;
|
|
|
|
#
|
|
|
|
##role rename
|
|
|
|
#rename user 'test_role1'@'' to 'test_role1_rm'@'';
|
|
|
|
#--sorted_result
|
|
|
|
#select user, host from user where user like 'test%';
|
|
|
|
#--sorted_result
|
|
|
|
#select * from roles_mapping;
|
2013-10-17 20:52:04 -07:00
|
|
|
|
|
|
|
delete from mysql.roles_mapping;
|
|
|
|
delete from mysql.user where user like 'test%';
|
|
|
|
flush privileges;
|
2013-10-18 12:17:49 -07:00
|
|
|
|