mariadb/mysql-test/suite/roles/set_default_role_clear.result
Fariha Shaikh 212fad1b7e MDEV-36397 Record change_user command in MTR output
MTR .result files currently do not contain output to indicate if a
change_user command has been executed in the corresponding .test files.

Record change_user command in the following format in MTR output only if
disable_query_log is set to false: change_user <user>,<password>,<db>;

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
2025-06-23 20:38:36 +02:00

42 lines
1.5 KiB
Text

create user test_user@localhost;
create role test_role;
grant select on *.* to test_role;
grant test_role to test_user@localhost;
change_user test_user,,;
show grants;
Grants for test_user@localhost
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
set default role test_role;
select user, host, default_role from mysql.user;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user`
change_user root,,;
select user, host, default_role from mysql.user where user='test_user';
User Host default_role
test_user localhost test_role
change_user test_user,,;
show grants;
Grants for test_user@localhost
GRANT `test_role` TO `test_user`@`localhost`
GRANT USAGE ON *.* TO `test_user`@`localhost`
GRANT SELECT ON *.* TO `test_role`
SET DEFAULT ROLE `test_role` FOR `test_user`@`localhost`
select user, host, default_role from mysql.user where user='test_user';
User Host default_role
test_user localhost test_role
set default role NONE;
select user, host, default_role from mysql.user where user='test_user';
User Host default_role
test_user localhost
set default role invalid_role;
ERROR OP000: Invalid role specification `invalid_role`
change_user root,,;
select user, host, default_role from mysql.user where user='test_user';
User Host default_role
test_user localhost
change_user test_user,,;
select user, host, default_role from mysql.user;
ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`user`
change_user root,,;
drop role test_role;
drop user test_user@localhost;