Debian Codegraph @

mysql-test/suite/roles/set_role-simple.result

raw
1 create user test_user@localhost;
2 create role test_role1;
3 grant test_role1 to test_user@localhost;
4 select user, host from mysql.user where user not like 'root';
5 User Host
6 mariadb.sys localhost
7 test_role1
8 test_user localhost
9 select * from mysql.roles_mapping;
10 Host User Role Admin_option
11 localhost root test_role1 Y
12 localhost test_user test_role1 N
13 grant select on *.* to test_role1;
14 select * from mysql.user where user='test_role1';
15 Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
16 test_role1 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N Y 0.000000
17 select * from mysql.roles_mapping;
18 ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping`
19 show grants;
20 Grants for test_user@localhost
21 GRANT USAGE ON *.* TO `test_user`@`localhost`
22 GRANT `test_role1` TO `test_user`@`localhost`
23 select current_user(), current_role();
24 current_user() current_role()
25 test_user@localhost NULL
26 set role test_role1;
27 select current_user(), current_role();
28 current_user() current_role()
29 test_user@localhost test_role1
30 show grants;
31 Grants for test_user@localhost
32 GRANT SELECT ON *.* TO `test_role1`
33 GRANT USAGE ON *.* TO `test_user`@`localhost`
34 GRANT `test_role1` TO `test_user`@`localhost`
35 select * from mysql.roles_mapping;
36 Host User Role Admin_option
37 localhost root test_role1 Y
38 localhost test_user test_role1 N
39 set role none;
40 select current_user(), current_role();
41 current_user() current_role()
42 test_user@localhost NULL
43 select * from mysql.roles_mapping;
44 ERROR 42000: SELECT command denied to user 'test_user'@'localhost' for table `mysql`.`roles_mapping`
45 delete from mysql.user where user='test_role1';
46 delete from mysql.roles_mapping where Role='test_role1';
47 flush privileges;
48 drop user 'test_user'@'localhost';
49 create user user1;
50 connect con1,localhost,user1,,;
51 select current_user;
52 current_user
53 user1@%
54 show grants;
55 Grants for user1@%
56 GRANT USAGE ON *.* TO `user1`@`%`
57 set role none;
58 connection default;
59 drop user user1;