mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
This changeset is result of
WL#3982 Test information_schema.processlist and replaces the corresponding tests pushed to mysql-test-extra-5.1/mysql-test/qa-suite/info_schema mysql-test/suite/funcs_1/datadict/datadict_priv.inc: Auxiliary script mysql-test/suite/funcs_1/datadict/processlist_priv.inc: Test of privileges mysql-test/suite/funcs_1/datadict/processlist_val.inc: Test of values mysql-test/suite/funcs_1/r/a_processlist_priv_no_prot.result: Expected results mysql-test/suite/funcs_1/r/a_processlist_val_no_prot.result: Expected results mysql-test/suite/funcs_1/r/b_processlist_priv_ps.result: Expected results mysql-test/suite/funcs_1/r/b_processlist_val_ps.result: Expected results mysql-test/suite/funcs_1/t/a_processlist_priv_no_prot.test: Test of privileges - variant without ps/sp/cursor/view-protocol mysql-test/suite/funcs_1/t/a_processlist_val_no_prot.test: Test of values - variant without ps/sp/cursor/view-protocol mysql-test/suite/funcs_1/t/b_processlist_priv_ps.test: Test of privileges - variant with ps-protocol mysql-test/suite/funcs_1/t/b_processlist_val_ps.test: Test of values - variant with ps-protocol
This commit is contained in:
469
mysql-test/suite/funcs_1/r/a_processlist_priv_no_prot.result
Normal file
469
mysql-test/suite/funcs_1/r/a_processlist_priv_no_prot.result
Normal file
@ -0,0 +1,469 @@
|
||||
USE information_schema;
|
||||
####################################################################################
|
||||
1 Prepare test.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
1.1 Create two user
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser1'@'localhost'
|
||||
DROP USER ddicttestuser2@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser2'@'localhost'
|
||||
CREATE USER ddicttestuser1@'localhost';
|
||||
CREATE USER ddicttestuser2@'localhost';
|
||||
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
|
||||
SET PASSWORD FOR ddicttestuser2@'localhost' = PASSWORD('ddictpass');
|
||||
####################################################################################
|
||||
1.2 Establish connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
2 connection default(user=root with default privileges):
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW CREATE TABLE processlist;
|
||||
Table Create Table
|
||||
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
|
||||
`ID` bigint(4) NOT NULL DEFAULT '0',
|
||||
`USER` varchar(16) NOT NULL DEFAULT '',
|
||||
`HOST` varchar(64) NOT NULL DEFAULT '',
|
||||
`DB` varchar(64) DEFAULT NULL,
|
||||
`COMMAND` varchar(16) NOT NULL DEFAULT '',
|
||||
`TIME` bigint(7) NOT NULL DEFAULT '0',
|
||||
`STATE` varchar(64) DEFAULT NULL,
|
||||
`INFO` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
1 root localhost information_schema Query TIME NULL SHOW processlist
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
SELECT * FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
1 root localhost information_schema Query TIME preparing SELECT * FROM processlist ORDER BY id
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
1 root localhost information_schema Query TIME preparing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist;
|
||||
UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
|
||||
INSERT INTO processlist SELECT * FROM test.t_processlist;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE test.t_processlist;
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION;
|
||||
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist;
|
||||
UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP VIEW test.v_processlist;
|
||||
UPDATE processlist SET user='any_user' WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DELETE FROM processlist WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
REVOKE ALL ON processlist FROM current_user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
GRANT INSERT,UPDATE ON processlist TO current_user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
SHOW GRANTS;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
CREATE INDEX i_processlist ON processlist (user);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE processlist;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist DROP COLUMN user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist ADD COLUMN (my_column INT);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
RENAME TABLE processlist TO new_processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
RENAME TABLE processlist TO files;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
CREATE TABLE new_processlist AS SELECT * FROM processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
DROP DATABASE information_schema;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
RENAME DATABASE information_schema TO info_schema;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
3 Switch to connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
SHOW/SELECT shows only the processes (1) of the user.
|
||||
####################################################################################
|
||||
SHOW CREATE TABLE processlist;
|
||||
Table Create Table
|
||||
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
|
||||
`ID` bigint(4) NOT NULL DEFAULT '0',
|
||||
`USER` varchar(16) NOT NULL DEFAULT '',
|
||||
`HOST` varchar(64) NOT NULL DEFAULT '',
|
||||
`DB` varchar(64) DEFAULT NULL,
|
||||
`COMMAND` varchar(16) NOT NULL DEFAULT '',
|
||||
`TIME` bigint(7) NOT NULL DEFAULT '0',
|
||||
`STATE` varchar(64) DEFAULT NULL,
|
||||
`INFO` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
2 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM processlist ORDER BY id
|
||||
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
2 ddicttestuser1 localhost information_schema Query TIME preparing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id
|
||||
CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist;
|
||||
UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
|
||||
INSERT INTO processlist SELECT * FROM test.t_processlist;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP TABLE test.t_processlist;
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION;
|
||||
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist;
|
||||
UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP VIEW test.v_processlist;
|
||||
UPDATE processlist SET user='any_user' WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DELETE FROM processlist WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
REVOKE ALL ON processlist FROM current_user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
GRANT INSERT,UPDATE ON processlist TO current_user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
CREATE INDEX i_processlist ON processlist (user);
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP TABLE processlist;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist DROP COLUMN user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist ADD COLUMN (my_column INT);
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
RENAME TABLE processlist TO new_processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
RENAME TABLE processlist TO files;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
CREATE TABLE new_processlist AS SELECT * FROM processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
DROP DATABASE information_schema;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
RENAME DATABASE information_schema TO info_schema;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
4 Grant PROCESS privilege to ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
####################################################################################
|
||||
4.1 Existing connection con100 (ddicttestuser1)
|
||||
The user ddicttestuser1 has the PROCESS privilege, but the connection was
|
||||
established before PROCESS was granted.
|
||||
SHOW/SELECT shows only the processes (1) of the user.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
2 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
####################################################################################
|
||||
4.2 New connection con101 (ddicttestuser1 with PROCESS privilege)
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
3 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
5 Grant PROCESS privilege to anonymous user.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT PROCESS ON *.* TO ''@'localhost';
|
||||
####################################################################################
|
||||
5.1 Establish connection (anonymous1,localhost,'',,information_schema)
|
||||
anonymous user with PROCESS privilege
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for @localhost
|
||||
GRANT PROCESS ON *.* TO ''@'localhost'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
4 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
6 Revoke PROCESS privilege from ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
####################################################################################
|
||||
6.1 New connection con102 (ddicttestuser1 has no more PROCESS privilege)
|
||||
Again (compared to state before GRANT PROCESS) only the processes of
|
||||
ddicttestuser1 are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
5 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ''@'localhost';
|
||||
####################################################################################
|
||||
7.1 New connection (anonymous2,localhost,'',,information_schema)
|
||||
The anonymous user has no more the PROCESS privilege
|
||||
Again only the processes of the anonymous user are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR ''@'localhost';
|
||||
Grants for @localhost
|
||||
GRANT USAGE ON *.* TO ''@'localhost'
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
6 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
4 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
8.1 New connection con103 (ddicttestuser1 with SUPER privilege)
|
||||
Only the processes of ddicttestuser1 user are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
7 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
9 Revoke SUPER privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SUPER ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
9.1 New connection con104 (ddicttestuser1 without SUPER privilege)
|
||||
ddicttestuser1 has no more the SUPER privilege.
|
||||
Only the processes of ddicttestuser1 are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
8 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
10 Grant SUPER privilege with grant option to user ddicttestuser1.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
####################################################################################
|
||||
10.1 New connection con105 (ddicttestuser1 with SUPER privilege and GRANT OPTION)
|
||||
Try to grant PROCESS privilege to user ddicttestuser2 without having it.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES)
|
||||
####################################################################################
|
||||
10.2 Grant SUPER and PROCESS privilege with grant option to user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER,PROCESS ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
####################################################################################
|
||||
10.3 New connection con106 (ddicttestuser1 with SUPER,PROCESS WITH GRANT OPTION)
|
||||
Grant PROCESS privilege to user ddicttestuser2
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS, SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
####################################################################################
|
||||
10.4 New connection con200 (ddicttestuser2 with PROCESS privilege)
|
||||
ddicttestuser2 has now the PROCESS privilege and sees all connections
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
|
||||
Grants for ddicttestuser2@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser2 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
11 ddicttestuser2 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
1 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2
|
||||
connection ddicttestuser1;
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM 'ddicttestuser2'@'localhost';
|
||||
####################################################################################
|
||||
11.1 New connection con201 (ddicttestuser2)
|
||||
ddicttestuser2 has no more the PROCESS privilege and can only see own connects
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser2@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser2'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
11 ddicttestuser2 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser2 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
12 ddicttestuser2 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
11 ddicttestuser2 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SUPER,PROCESS,GRANT OPTION ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
11.3 New connection con107 (ddicttestuser1)
|
||||
ddicttestuser1 has no more the PROCESS privilege and can only see own connects
|
||||
He is also unable to GRANT the PROCESS privilege to ddicttestuser2
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES)
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
13 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
13 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
12 Revoke the SELECT privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SELECT ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
12.1 New connection con108 (ddicttestuser1)
|
||||
ddicttestuser1 has neither PROCESS nor SELECT privilege
|
||||
Manual says: Each MySQL user has the right to access these tables, but can see
|
||||
only the rows ...
|
||||
Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
13 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
14 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
14 ddicttestuser1 localhost information_schema Query TIME preparing SELECT * FROM information_schema.processlist
|
||||
13 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
2 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SELECT ON information_schema.* FROM 'ddicttestuser3'@'localhost';
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
connection default (user=root)
|
||||
Cleanup: close connections, DROP USER etc.
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
DROP USER ddicttestuser2@'localhost';
|
174
mysql-test/suite/funcs_1/r/a_processlist_val_no_prot.result
Normal file
174
mysql-test/suite/funcs_1/r/a_processlist_val_no_prot.result
Normal file
File diff suppressed because one or more lines are too long
469
mysql-test/suite/funcs_1/r/b_processlist_priv_ps.result
Normal file
469
mysql-test/suite/funcs_1/r/b_processlist_priv_ps.result
Normal file
@ -0,0 +1,469 @@
|
||||
USE information_schema;
|
||||
####################################################################################
|
||||
1 Prepare test.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
1.1 Create two user
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser1'@'localhost'
|
||||
DROP USER ddicttestuser2@'localhost';
|
||||
ERROR HY000: Operation DROP USER failed for 'ddicttestuser2'@'localhost'
|
||||
CREATE USER ddicttestuser1@'localhost';
|
||||
CREATE USER ddicttestuser2@'localhost';
|
||||
SET PASSWORD FOR ddicttestuser1@'localhost' = PASSWORD('ddictpass');
|
||||
SET PASSWORD FOR ddicttestuser2@'localhost' = PASSWORD('ddictpass');
|
||||
####################################################################################
|
||||
1.2 Establish connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
####################################################################################
|
||||
####################################################################################
|
||||
2 connection default(user=root with default privileges):
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW CREATE TABLE processlist;
|
||||
Table Create Table
|
||||
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
|
||||
`ID` bigint(4) NOT NULL DEFAULT '0',
|
||||
`USER` varchar(16) NOT NULL DEFAULT '',
|
||||
`HOST` varchar(64) NOT NULL DEFAULT '',
|
||||
`DB` varchar(64) DEFAULT NULL,
|
||||
`COMMAND` varchar(16) NOT NULL DEFAULT '',
|
||||
`TIME` bigint(7) NOT NULL DEFAULT '0',
|
||||
`STATE` varchar(64) DEFAULT NULL,
|
||||
`INFO` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
3 root localhost information_schema Query TIME NULL SHOW processlist
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
SELECT * FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
3 root localhost information_schema Execute TIME preparing SELECT * FROM processlist ORDER BY id
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
3 root localhost information_schema Execute TIME preparing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist;
|
||||
UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
|
||||
INSERT INTO processlist SELECT * FROM test.t_processlist;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE test.t_processlist;
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION;
|
||||
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist;
|
||||
UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP VIEW test.v_processlist;
|
||||
UPDATE processlist SET user='any_user' WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DELETE FROM processlist WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
REVOKE ALL ON processlist FROM current_user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
GRANT INSERT,UPDATE ON processlist TO current_user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
SHOW GRANTS;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
CREATE INDEX i_processlist ON processlist (user);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
DROP TABLE processlist;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist DROP COLUMN user;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist ADD COLUMN (my_column INT);
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
RENAME TABLE processlist TO new_processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
RENAME TABLE processlist TO files;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
CREATE TABLE new_processlist AS SELECT * FROM processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
DROP DATABASE information_schema;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
RENAME DATABASE information_schema TO info_schema;
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
3 Switch to connection con100 (user=ddicttestuser1 with no PROCESS privilege):
|
||||
SHOW/SELECT shows only the processes (1) of the user.
|
||||
####################################################################################
|
||||
SHOW CREATE TABLE processlist;
|
||||
Table Create Table
|
||||
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
|
||||
`ID` bigint(4) NOT NULL DEFAULT '0',
|
||||
`USER` varchar(16) NOT NULL DEFAULT '',
|
||||
`HOST` varchar(64) NOT NULL DEFAULT '',
|
||||
`DB` varchar(64) DEFAULT NULL,
|
||||
`COMMAND` varchar(16) NOT NULL DEFAULT '',
|
||||
`TIME` bigint(7) NOT NULL DEFAULT '0',
|
||||
`STATE` varchar(64) DEFAULT NULL,
|
||||
`INFO` longtext
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
4 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM processlist ORDER BY id
|
||||
SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
4 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO FROM processlist ORDER BY id
|
||||
CREATE TEMPORARY TABLE test.t_processlist AS SELECT * FROM processlist;
|
||||
UPDATE test.t_processlist SET user='horst' WHERE id=1 ;
|
||||
INSERT INTO processlist SELECT * FROM test.t_processlist;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP TABLE test.t_processlist;
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist WITH CHECK OPTION;
|
||||
ERROR HY000: CHECK OPTION on non-updatable view 'test.v_processlist'
|
||||
CREATE VIEW test.v_processlist (ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO) AS SELECT * FROM processlist;
|
||||
UPDATE test.v_processlist SET TIME=NOW() WHERE id = 1;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP VIEW test.v_processlist;
|
||||
UPDATE processlist SET user='any_user' WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DELETE FROM processlist WHERE id=1 ;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
REVOKE ALL ON processlist FROM current_user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
GRANT INSERT,UPDATE ON processlist TO current_user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
CREATE INDEX i_processlist ON processlist (user);
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
DROP TABLE processlist;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist DROP COLUMN user;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
ALTER TABLE processlist ADD COLUMN (my_column INT);
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
RENAME TABLE processlist TO new_processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
RENAME TABLE processlist TO files;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
CREATE TABLE new_processlist AS SELECT * FROM processlist;
|
||||
ERROR 42S02: Unknown table 'new_processlist' in information_schema
|
||||
DROP DATABASE information_schema;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
RENAME DATABASE information_schema TO info_schema;
|
||||
ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
4 Grant PROCESS privilege to ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
####################################################################################
|
||||
4.1 Existing connection con100 (ddicttestuser1)
|
||||
The user ddicttestuser1 has the PROCESS privilege, but the connection was
|
||||
established before PROCESS was granted.
|
||||
SHOW/SELECT shows only the processes (1) of the user.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
4 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
####################################################################################
|
||||
4.2 New connection con101 (ddicttestuser1 with PROCESS privilege)
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
5 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
5 Grant PROCESS privilege to anonymous user.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT PROCESS ON *.* TO ''@'localhost';
|
||||
####################################################################################
|
||||
5.1 Establish connection (anonymous1,localhost,'',,information_schema)
|
||||
anonymous user with PROCESS privilege
|
||||
SHOW/SELECT shows all processes/threads.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for @localhost
|
||||
GRANT PROCESS ON *.* TO ''@'localhost'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
6 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
6 Revoke PROCESS privilege from ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
|
||||
####################################################################################
|
||||
6.1 New connection con102 (ddicttestuser1 has no more PROCESS privilege)
|
||||
Again (compared to state before GRANT PROCESS) only the processes of
|
||||
ddicttestuser1 are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
7 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
7 Revoke PROCESS privilege from anonymous user + disconnect ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM ''@'localhost';
|
||||
####################################################################################
|
||||
7.1 New connection (anonymous2,localhost,'',,information_schema)
|
||||
The anonymous user has no more the PROCESS privilege
|
||||
Again only the processes of the anonymous user are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR ''@'localhost';
|
||||
Grants for @localhost
|
||||
GRANT USAGE ON *.* TO ''@'localhost'
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
8 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
8.1 New connection con103 (ddicttestuser1 with SUPER privilege)
|
||||
Only the processes of ddicttestuser1 user are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
9 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
9 Revoke SUPER privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SUPER ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
9.1 New connection con104 (ddicttestuser1 without SUPER privilege)
|
||||
ddicttestuser1 has no more the SUPER privilege.
|
||||
Only the processes of ddicttestuser1 are visible.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
10 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
10 Grant SUPER privilege with grant option to user ddicttestuser1.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
####################################################################################
|
||||
10.1 New connection con105 (ddicttestuser1 with SUPER privilege and GRANT OPTION)
|
||||
Try to grant PROCESS privilege to user ddicttestuser2 without having it.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES)
|
||||
####################################################################################
|
||||
10.2 Grant SUPER and PROCESS privilege with grant option to user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
GRANT SUPER,PROCESS ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
|
||||
####################################################################################
|
||||
10.3 New connection con106 (ddicttestuser1 with SUPER,PROCESS WITH GRANT OPTION)
|
||||
Grant PROCESS privilege to user ddicttestuser2
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT PROCESS, SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1' WITH GRANT OPTION
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
####################################################################################
|
||||
10.4 New connection con200 (ddicttestuser2 with PROCESS privilege)
|
||||
ddicttestuser2 has now the PROCESS privilege and sees all connections
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
|
||||
Grants for ddicttestuser2@localhost
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
13 ddicttestuser2 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
13 ddicttestuser2 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
8 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
6 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
3 root localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2
|
||||
connection ddicttestuser1;
|
||||
####################################################################################
|
||||
REVOKE PROCESS ON *.* FROM 'ddicttestuser2'@'localhost';
|
||||
####################################################################################
|
||||
11.1 New connection con201 (ddicttestuser2)
|
||||
ddicttestuser2 has no more the PROCESS privilege and can only see own connects
|
||||
####################################################################################
|
||||
SHOW GRANTS;
|
||||
Grants for ddicttestuser2@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser2'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
13 ddicttestuser2 localhost information_schema Sleep TIME NULL
|
||||
14 ddicttestuser2 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
14 ddicttestuser2 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
13 ddicttestuser2 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SUPER,PROCESS,GRANT OPTION ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
11.3 New connection con107 (ddicttestuser1)
|
||||
ddicttestuser1 has no more the PROCESS privilege and can only see own connects
|
||||
He is also unable to GRANT the PROCESS privilege to ddicttestuser2
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
|
||||
ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password: YES)
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
15 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
15 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
12 Revoke the SELECT privilege from user ddicttestuser1
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SELECT ON *.* FROM 'ddicttestuser1'@'localhost';
|
||||
####################################################################################
|
||||
12.1 New connection con108 (ddicttestuser1)
|
||||
ddicttestuser1 has neither PROCESS nor SELECT privilege
|
||||
Manual says: Each MySQL user has the right to access these tables, but can see
|
||||
only the rows ...
|
||||
Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST.
|
||||
####################################################################################
|
||||
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
|
||||
Grants for ddicttestuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
|
||||
SHOW processlist;
|
||||
Id User Host db Command Time State Info
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
15 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
16 ddicttestuser1 localhost information_schema Query TIME NULL SHOW processlist
|
||||
SELECT * FROM information_schema.processlist;
|
||||
ID USER HOST DB COMMAND TIME STATE INFO
|
||||
16 ddicttestuser1 localhost information_schema Execute TIME preparing SELECT * FROM information_schema.processlist
|
||||
15 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
12 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
11 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
10 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
9 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
7 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
5 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
4 ddicttestuser1 localhost information_schema Sleep TIME NULL
|
||||
####################################################################################
|
||||
12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1.
|
||||
connection default (user=root)
|
||||
####################################################################################
|
||||
REVOKE SELECT ON information_schema.* FROM 'ddicttestuser3'@'localhost';
|
||||
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||
####################################################################################
|
||||
connection default (user=root)
|
||||
Cleanup: close connections, DROP USER etc.
|
||||
####################################################################################
|
||||
DROP USER ddicttestuser1@'localhost';
|
||||
DROP USER ddicttestuser2@'localhost';
|
174
mysql-test/suite/funcs_1/r/b_processlist_val_ps.result
Normal file
174
mysql-test/suite/funcs_1/r/b_processlist_val_ps.result
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user