2013-10-18 18:56:28 -07:00
|
|
|
source include/not_embedded.inc;
|
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:21:10 -07:00
|
|
|
grant test_role1 to test_user@localhost;
|
2013-10-18 12:17:49 -07:00
|
|
|
create role test_role2;
|
2013-10-18 12:21:10 -07:00
|
|
|
grant test_role2 to test_role1;
|
2013-10-17 20:52:04 -07:00
|
|
|
|
|
|
|
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
|
|
|
|
2022-07-29 21:57:06 +02:00
|
|
|
--echo #
|
|
|
|
--echo # MDEV-29131 Assertion `status == 0' failed when renaming user after deleting table roles_mapping
|
|
|
|
--echo #
|
|
|
|
create role r;
|
|
|
|
rename table mysql.roles_mapping to test.t1;
|
|
|
|
rename user current_user to a@a;
|
|
|
|
rename user a@a to root@localhost;
|
|
|
|
rename table test.t1 to mysql.roles_mapping;
|
|
|
|
drop role r;
|
|
|
|
|