mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 20:36:16 +01:00 
			
		
		
		
	- Used single quotes, back quotes are used with commit
fafb35ee51 in 10.3 and will be changed.
Reviewed by: serg@mariadb.org
		
	
			
		
			
				
	
	
		
			89 lines
		
	
	
	
		
			2.8 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
	
		
			2.8 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
connect  mysql, localhost, root,,;
 | 
						|
use mysql;
 | 
						|
create role test_role1@host1;
 | 
						|
ERROR 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
 | 
						|
create role test_role2@host2, test_role1@host1;
 | 
						|
ERROR 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
 | 
						|
create role test_role1;
 | 
						|
create role test_role2, test_role3;
 | 
						|
select user, host, is_role from user where user like 'test%';
 | 
						|
User	Host	is_role
 | 
						|
test_role1		Y
 | 
						|
test_role2		Y
 | 
						|
test_role3		Y
 | 
						|
drop role test_role1;
 | 
						|
drop role test_role2, test_role3;
 | 
						|
create role test_role1;
 | 
						|
create role test_role1;
 | 
						|
ERROR HY000: Operation CREATE ROLE failed for 'test_role1'
 | 
						|
create role test_role1, test_role2;
 | 
						|
ERROR HY000: Operation CREATE ROLE failed for 'test_role1'
 | 
						|
select user, host, is_role from user where user like 'test%';
 | 
						|
User	Host	is_role
 | 
						|
test_role1		Y
 | 
						|
test_role2		Y
 | 
						|
drop role test_role1;
 | 
						|
drop role test_role1;
 | 
						|
ERROR HY000: Operation DROP ROLE failed for 'test_role1'
 | 
						|
drop role test_role1, test_role2;
 | 
						|
ERROR HY000: Operation DROP ROLE failed for 'test_role1'
 | 
						|
drop role root;
 | 
						|
ERROR HY000: Operation DROP ROLE failed for 'root'
 | 
						|
create user dummy@'';
 | 
						|
drop role dummy;
 | 
						|
ERROR HY000: Operation DROP ROLE failed for 'dummy'
 | 
						|
drop user dummy@'';
 | 
						|
select user, host, is_role from user where user like 'test%';
 | 
						|
User	Host	is_role
 | 
						|
disconnect mysql;
 | 
						|
connection default;
 | 
						|
create role '';
 | 
						|
ERROR OP000: Invalid role specification ``
 | 
						|
create role ' ';
 | 
						|
ERROR OP000: Invalid role specification ``
 | 
						|
create role 'foo  ';
 | 
						|
drop role foo;
 | 
						|
create role r1;
 | 
						|
drop user r1;
 | 
						|
ERROR HY000: Operation DROP USER failed for 'r1'@'%'
 | 
						|
drop role r1;
 | 
						|
create role r1 with admin u1;
 | 
						|
Warnings:
 | 
						|
Note	1449	The user specified as a definer ('u1'@'%') does not exist
 | 
						|
create user foo@bar;
 | 
						|
drop user foo@bar;
 | 
						|
drop role r1;
 | 
						|
CREATE USER u1;
 | 
						|
CREATE ROLE r1;
 | 
						|
CREATE USER r1@localhost;
 | 
						|
CREATE ROLE r2;
 | 
						|
GRANT r2 to r1;
 | 
						|
GRANT r2 to r1@localhost;
 | 
						|
DROP ROLE r1;
 | 
						|
SELECT * FROM mysql.roles_mapping;
 | 
						|
Host	User	Role	Admin_option
 | 
						|
localhost	r1	r2	N
 | 
						|
localhost	root	r2	Y
 | 
						|
SHOW GRANTS FOR r1@localhost;
 | 
						|
Grants for r1@localhost
 | 
						|
GRANT `r2` TO `r1`@`localhost`
 | 
						|
GRANT USAGE ON *.* TO `r1`@`localhost`
 | 
						|
DROP USER u1;
 | 
						|
DROP ROLE r2;
 | 
						|
DROP USER r1@localhost;
 | 
						|
create role 'foo  ';
 | 
						|
select concat(user, '__'), is_role from mysql.user where user like 'foo%';
 | 
						|
concat(user, '__')	is_role
 | 
						|
foo__	Y
 | 
						|
select * from mysql.roles_mapping;
 | 
						|
Host	User	Role	Admin_option
 | 
						|
localhost	root	foo	Y
 | 
						|
drop role foo;
 | 
						|
select concat(user, '__'), is_role from mysql.user where user like 'foo%';
 | 
						|
concat(user, '__')	is_role
 | 
						|
select * from mysql.roles_mapping;
 | 
						|
Host	User	Role	Admin_option
 | 
						|
show grants;
 | 
						|
Grants for root@localhost
 | 
						|
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
 | 
						|
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
 |