1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-30 05:23:50 +03:00
Files
mariadb/mysql-test/r/grant5.result
Anel Husakovic d2dddbff4e MDEV-26080: SHOW GRANTS does not quote role names properly for DEFAULT ROLE
- Used single quotes, back quotes are used with commit
fafb35ee51 in 10.3 and will be changed.

Reviewed by: serg@mariadb.org
2021-07-09 08:25:54 +02:00

105 lines
3.2 KiB
Plaintext

SHOW GRANTS FOR root@invalid_host;
ERROR 42000: There is no such grant defined for user 'root' on host 'invalid_host'
create user test;
create user foo;
create role foo;
grant foo to test;
connect conn_1, localhost, test,,;
set role foo;
show grants for test;
Grants for test@%
GRANT 'foo' TO 'test'@'%'
GRANT USAGE ON *.* TO 'test'@'%'
show grants for foo;
Grants for foo
GRANT USAGE ON *.* TO 'foo'
show grants for foo@'%';
ERROR 42000: Access denied for user 'test'@'%' to database 'mysql'
connection default;
disconnect conn_1;
drop user test, foo;
drop role foo;
CREATE TABLE t1 (a INT);
LOCK TABLE t1 WRITE;
REVOKE EXECUTE ON PROCEDURE sp FROM u;
ERROR HY000: Table 'user' was not locked with LOCK TABLES
REVOKE PROCESS ON *.* FROM u;
ERROR HY000: Table 'user' was not locked with LOCK TABLES
DROP TABLE t1;
create database mysqltest1;
use mysqltest1;
create table t1(id int);
insert t1 values(2);
create user u1@localhost;
grant select on mysqltest1.t1 to u1@localhost;
grant update on mysqltest1.* to u1@localhost;
connect u1, localhost, u1;
update mysqltest1.t1 set id=1 where id=2;
connection default;
disconnect u1;
drop user u1@localhost;
drop database mysqltest1;
CREATE ROLE test_role;
CREATE USER test_user;
GRANT test_role TO test_user;
SET DEFAULT ROLE test_role FOR test_user;
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT 'test_role' TO 'test_user'@'%'
GRANT USAGE ON *.* TO 'test_user'@'%'
SET DEFAULT ROLE 'test_role' FOR 'test_user'@'%'
SET DEFAULT ROLE NONE for test_user;
SHOW GRANTS FOR test_user;
Grants for test_user@%
GRANT 'test_role' TO 'test_user'@'%'
GRANT USAGE ON *.* TO 'test_user'@'%'
SET ROLE test_role;
SET DEFAULT ROLE test_role;
SHOW GRANTS;
Grants for root@localhost
GRANT 'test_role' TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'test_role'
SET DEFAULT ROLE 'test_role' FOR 'root'@'localhost'
SET DEFAULT ROLE NONE;
SHOW GRANTS;
Grants for root@localhost
GRANT 'test_role' TO 'root'@'localhost' WITH ADMIN OPTION
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
GRANT USAGE ON *.* TO 'test_role'
DROP USER test_user;
DROP ROLE test_role;
CREATE ROLE 'test-role';
CREATE USER 'test-user';
GRANT 'test-role' TO 'test-user';
SET DEFAULT ROLE 'test-role' FOR 'test-user';
SHOW GRANTS FOR 'test-user';
Grants for test-user@%
GRANT 'test-role' TO 'test-user'@'%'
GRANT USAGE ON *.* TO 'test-user'@'%'
SET DEFAULT ROLE 'test-role' FOR 'test-user'@'%'
DROP ROLE 'test-role';
SHOW GRANTS FOR 'test-user';
Grants for test-user@%
GRANT USAGE ON *.* TO 'test-user'@'%'
SET DEFAULT ROLE 'test-role' FOR 'test-user'@'%'
SET DEFAULT ROLE NONE FOR 'test-user';
SHOW GRANTS FOR 'test-user';
Grants for test-user@%
GRANT USAGE ON *.* TO 'test-user'@'%'
CREATE ROLE `r``o'l"e`;
select user from mysql.user where is_role='Y';
user
r`o'l"e
GRANT `r``o'l"e` TO 'test-user';
SET DEFAULT ROLE `r``o'l"e` FOR 'test-user';
SHOW GRANTS FOR 'test-user';
Grants for test-user@%
GRANT 'r`o'l"e' TO 'test-user'@'%'
GRANT USAGE ON *.* TO 'test-user'@'%'
SET DEFAULT ROLE 'r`o'l"e' FOR 'test-user'@'%'
DROP ROLE `r``o'l"e`;
DROP USER 'test-user';