1connect  mysql, localhost, root,,;
2use mysql;
3create role test_role1@host1;
4ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@host1' at line 1
5create role test_role2@host2, test_role1@host1;
6ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '@host2, test_role1@host1' at line 1
7create role test_role1;
8create role test_role2, test_role3;
9select user, host, is_role from user where user like 'test%';
10user	host	is_role
11test_role1		Y
12test_role2		Y
13test_role3		Y
14drop role test_role1;
15drop role test_role2, test_role3;
16create role test_role1;
17create role test_role1;
18ERROR HY000: Operation CREATE ROLE failed for 'test_role1'
19create role test_role1, test_role2;
20ERROR HY000: Operation CREATE ROLE failed for 'test_role1'
21select user, host, is_role from user where user like 'test%';
22user	host	is_role
23test_role1		Y
24test_role2		Y
25drop role test_role1;
26drop role test_role1;
27ERROR HY000: Operation DROP ROLE failed for 'test_role1'
28drop role test_role1, test_role2;
29ERROR HY000: Operation DROP ROLE failed for 'test_role1'
30drop role root;
31ERROR HY000: Operation DROP ROLE failed for 'root'
32create user dummy@'';
33drop role dummy;
34ERROR HY000: Operation DROP ROLE failed for 'dummy'
35drop user dummy@'';
36select user, host, is_role from user where user like 'test%';
37user	host	is_role
38disconnect mysql;
39connection default;
40create role '';
41ERROR OP000: Invalid role specification ``
42create role ' ';
43ERROR OP000: Invalid role specification ``
44create role 'foo  ';
45drop role foo;
46create role r1;
47drop user r1;
48ERROR HY000: Operation DROP USER failed for 'r1'@'%'
49drop role r1;
50create role r1 with admin u1;
51Warnings:
52Note	1449	The user specified as a definer ('u1'@'%') does not exist
53create user foo@bar;
54drop user foo@bar;
55drop role r1;
56CREATE USER u1;
57CREATE ROLE r1;
58CREATE USER r1@localhost;
59CREATE ROLE r2;
60GRANT r2 to r1;
61GRANT r2 to r1@localhost;
62DROP ROLE r1;
63SELECT * FROM mysql.roles_mapping;
64Host	User	Role	Admin_option
65localhost	r1	r2	N
66localhost	root	r2	Y
67SHOW GRANTS FOR r1@localhost;
68Grants for r1@localhost
69GRANT `r2` TO `r1`@`localhost`
70GRANT USAGE ON *.* TO `r1`@`localhost`
71DROP USER u1;
72DROP ROLE r2;
73DROP USER r1@localhost;
74create role 'foo  ';
75select concat(user, '__'), is_role from mysql.user where user like 'foo%';
76concat(user, '__')	is_role
77foo__	Y
78select * from mysql.roles_mapping;
79Host	User	Role	Admin_option
80localhost	root	foo	Y
81drop role foo;
82select concat(user, '__'), is_role from mysql.user where user like 'foo%';
83concat(user, '__')	is_role
84select * from mysql.roles_mapping;
85Host	User	Role	Admin_option
86show grants;
87Grants for root@localhost
88GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
89GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
90