diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2016-03-25 20:51:22 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2016-03-31 10:11:16 +0400 |
commit | 282497dd6d1049b4fb963641504c2733752845a7 (patch) | |
tree | 7288d17c29fbbe9ac47ec51f6988fb954f59a361 /mysql-test/r/grant.result | |
parent | 5052e2479e873461bebfcedbc674bbaf57d3c968 (diff) | |
download | mariadb-git-282497dd6d1049b4fb963641504c2733752845a7.tar.gz |
MDEV-6720 - enable connection log in mysqltest by default
Diffstat (limited to 'mysql-test/r/grant.result')
-rw-r--r-- | mysql-test/r/grant.result | 398 |
1 files changed, 240 insertions, 158 deletions
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 3020c7deba7..5d44f47dede 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -4,6 +4,8 @@ SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creato SET GLOBAL log_bin_trust_function_creators = 1; drop table if exists t1; drop database if exists mysqltest; +connect master,localhost,root,,; +connection master; SET NAMES binary; delete from mysql.user where user='mysqltest_1'; delete from mysql.db where user='mysqltest_1'; @@ -518,6 +520,8 @@ grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost; grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost; grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost; +connect conn1,localhost,mysqltest_3,,; +connection conn1; SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES WHERE GRANTEE = '''mysqltest_3''@''localhost''' ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE; @@ -551,6 +555,7 @@ update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1' update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20; +connection master; select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; a q b r 10 2 1 2 @@ -565,6 +570,9 @@ grant all on mysqltest_2.* to mysqltest_3@localhost; grant select on *.* to mysqltest_3@localhost; grant select on mysqltest_2.t1 to mysqltest_3@localhost; flush privileges; +disconnect conn1; +connect conn2,localhost,mysqltest_3,,; +connection conn2; use mysqltest_1; update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; @@ -576,6 +584,7 @@ update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't2' update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' +connection master; select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; a q b r 10 2 1 2 @@ -589,6 +598,7 @@ delete from mysql.columns_priv where user="mysqltest_3"; flush privileges; drop database mysqltest_1; drop database mysqltest_2; +disconnect conn2; SHOW PRIVILEGES; Privilege Context Comment Alter Tables To alter the table @@ -622,14 +632,22 @@ Trigger Tables To use triggers Create tablespace Server Admin To create/alter/drop tablespaces Update Tables To update existing rows Usage Server Admin No privileges - allow connect only +connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connection root; create database mysqltest; create table mysqltest.t1 (a int,b int,c int); grant all on mysqltest.t1 to mysqltest_1@localhost; +connect user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK; +connection user1; alter table t1 rename t2; ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2' +disconnect user1; +connection root; revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; delete from mysql.user where user=_binary'mysqltest_1'; drop database mysqltest; +connection default; +disconnect root; CREATE USER dummy@localhost; CREATE DATABASE mysqltest; CREATE TABLE mysqltest.dummytable (dummyfield INT); @@ -742,6 +760,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost; DROP USER dummy@localhost; DROP DATABASE mysqltest; +connection default; use mysql; insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_grantor',CURRENT_TIMESTAMP,'Select','Select'); flush privileges; @@ -801,13 +820,18 @@ delete from mysql.db where user='mysqltest1'; delete from mysql.tables_priv where user='mysqltest1'; flush privileges; drop database mysqltest; +connection master; create database db27515; use db27515; create table t1 (a int); grant alter on db27515.t1 to user27515@localhost; grant insert, create on db27515.t2 to user27515@localhost; +connect conn27515, localhost, user27515, , db27515; +connection conn27515; rename table t1 to t2; ERROR 42000: DROP command denied to user 'user27515'@'localhost' for table 't1' +disconnect conn27515; +connection master; revoke all privileges, grant option from user27515@localhost; drop user user27515@localhost; drop database db27515; @@ -849,8 +873,11 @@ select * from information_schema.schema_privileges where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def mysqltest SELECT NO +connect conn3,localhost,mysqltest_8,,; select * from t1; a +disconnect conn3; +connection master; revoke select on mysqltest.* from mysqltest_8@''; show grants for mysqltest_8@''; Grants for mysqltest_8@% @@ -899,8 +926,11 @@ GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%' select * from information_schema.column_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def test t1 a UPDATE NO +connect conn4,localhost,mysqltest_8,,; select * from t1; a +disconnect conn4; +connection master; revoke update (a) on t1 from mysqltest_8@''; show grants for mysqltest_8@''; Grants for mysqltest_8@% @@ -940,8 +970,11 @@ GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%' select * from information_schema.table_privileges; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'%' def test t1 UPDATE NO +connect conn5,localhost,mysqltest_8,,; select * from t1; a +disconnect conn5; +connection master; revoke update on t1 from mysqltest_8@''; show grants for mysqltest_8@''; Grants for mysqltest_8@% @@ -979,8 +1012,11 @@ where grantee like "'mysqltest_8'%"; GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'mysqltest_8'@'host8' def USAGE NO 'mysqltest_8'@'%' def USAGE NO +connect conn5,localhost,mysqltest_8,,; select * from t1; a +disconnect conn5; +connection master; flush privileges; show grants for mysqltest_8@''; Grants for mysqltest_8@% @@ -996,7 +1032,9 @@ drop user mysqltest_8@''; show grants for mysqltest_8@''; ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%' connect(localhost,mysqltest_8,,test,MASTER_PORT,MASTER_SOCKET); +connect conn6,localhost,mysqltest_8,,; ERROR 28000: Access denied for user 'mysqltest_8'@'localhost' (using password: NO) +connection master; show grants for mysqltest_8; ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%' drop user mysqltest_8@host8; @@ -1006,6 +1044,7 @@ insert into mysql.user select * from t2; flush privileges; drop table t2; drop table t1; +connection master; CREATE DATABASE mysqltest3; USE mysqltest3; CREATE TABLE t_nn (c1 INT); @@ -1022,6 +1061,7 @@ GRANT SHOW VIEW ON mysqltest2.v_ny TO 'mysqltest_1'@'localhost' IDENTIFIE GRANT SELECT ON mysqltest2.v_yn TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; GRANT SELECT ON mysqltest2.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; GRANT SHOW VIEW,SELECT ON mysqltest2.v_yy TO 'mysqltest_1'@'localhost' IDENTIFIED BY 'mysqltest_1'; +connect mysqltest_1, localhost, mysqltest_1, mysqltest_1,; SHOW CREATE VIEW mysqltest2.v_nn; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn' SHOW CREATE TABLE mysqltest2.v_nn; @@ -1057,6 +1097,7 @@ v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER SHOW CREATE TABLE mysqltest2.v_yy; View Create View character_set_client collation_connection v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci +connection master; SHOW CREATE TABLE mysqltest2.v_nn; View Create View character_set_client collation_connection v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` latin1 latin1_swedish_ci @@ -1079,9 +1120,12 @@ DROP DATABASE mysqltest2; DROP VIEW mysqltest3.v_nn; DROP TABLE mysqltest3.t_nn; DROP DATABASE mysqltest3; +disconnect mysqltest_1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost'; DROP USER 'mysqltest_1'@'localhost'; USE test; +connection default; +disconnect master; create user longer_than_80_456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789; ERROR HY000: String 'longer_than_80_4567890123456789012345678901234567890123456789012345678' is too long for user name (should be no longer than 80) CREATE DATABASE mysqltest1; @@ -1095,6 +1139,7 @@ CREATE TABLE mysqltest1.t2 (int_field INT); "RENAME TABLE and ALTER TABLE" CREATE USER mysqltest_1@localhost; GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost; +connect conn42,localhost,mysqltest_1,,mysqltest1; SELECT USER(); USER() mysqltest_1@localhost @@ -1106,12 +1151,18 @@ RENAME TABLE t1 TO t2; ERROR 42000: DROP, ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' ALTER TABLE t1 RENAME TO t2; ERROR 42000: DROP, ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +disconnect conn42; +connection default; GRANT DROP ON mysqltest1.t1 TO mysqltest_1@localhost; +connect conn42,localhost,mysqltest_1,,mysqltest1; RENAME TABLE t1 TO t2; ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' ALTER TABLE t1 RENAME TO t2; ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' +disconnect conn42; +connection default; GRANT ALTER ON mysqltest1.t1 TO mysqltest_1@localhost; +connect conn42,localhost,mysqltest_1,,mysqltest1; SHOW GRANTS; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' @@ -1120,13 +1171,19 @@ RENAME TABLE t1 TO t2; ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2' ALTER TABLE t1 RENAME TO t2; ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2' +disconnect conn42; +connection default; GRANT INSERT, CREATE ON mysqltest1.t1 TO mysqltest_1@localhost; +connect conn42,localhost,mysqltest_1,,mysqltest1; SHOW GRANTS; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost' +disconnect conn42; +connection default; GRANT INSERT, SELECT, CREATE, ALTER, DROP ON mysqltest1.t2 TO mysqltest_1@localhost; DROP TABLE mysqltest1.t2; +connect conn42,localhost,mysqltest_1,,mysqltest1; SHOW GRANTS; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' @@ -1136,8 +1193,11 @@ RENAME TABLE t1 TO t2; RENAME TABLE t2 TO t1; ALTER TABLE t1 RENAME TO t2; ALTER TABLE t2 RENAME TO t1; +disconnect conn42; +connection default; REVOKE DROP, INSERT ON mysqltest1.t1 FROM mysqltest_1@localhost; REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost; +connect conn42,localhost,mysqltest_1,,mysqltest1; SHOW GRANTS; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' @@ -1147,6 +1207,8 @@ RENAME TABLE t1 TO t2; ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' ALTER TABLE t1 RENAME TO t2; ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1' +disconnect conn42; +connection default; DROP USER mysqltest_1@localhost; DROP DATABASE mysqltest1; USE test; @@ -1177,25 +1239,37 @@ ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghi CREATE USER bug23556@localhost; CREATE DATABASE bug23556; GRANT SELECT ON bug23556.* TO bug23556@localhost; +connect bug23556,localhost,bug23556,,bug23556; +connection default; USE bug23556; CREATE TABLE t1 (a INT PRIMARY KEY); INSERT INTO t1 VALUES (1),(2),(3),(4),(5); GRANT DELETE ON t1 TO bug23556@localhost; +connection bug23556; USE bug23556; TRUNCATE t1; ERROR 42000: DROP command denied to user 'bug23556'@'localhost' for table 't1' +connection default; USE bug23556; REVOKE DELETE ON t1 FROM bug23556@localhost; GRANT DROP ON t1 TO bug23556@localhost; +connection bug23556; USE bug23556; TRUNCATE t1; +connection default; USE bug23556; DROP TABLE t1; USE test; DROP DATABASE bug23556; DROP USER bug23556@localhost; +connection default; +disconnect bug23556; +connect con1, localhost, root,,*NO-ONE*; +connection con1; GRANT PROCESS ON * TO user@localhost; ERROR 3D000: No database selected +disconnect con1; +connection default; DROP DATABASE IF EXISTS mysqltest1; DROP DATABASE IF EXISTS mysqltest2; DROP DATABASE IF EXISTS mysqltest3; @@ -1217,8 +1291,7 @@ GRANT EXECUTE ON PROCEDURE mysqltest2.p_inv TO mysqltest_1@localhost; GRANT EXECUTE ON FUNCTION mysqltest3.f_def TO mysqltest_1@localhost; GRANT EXECUTE ON FUNCTION mysqltest4.f_inv TO mysqltest_1@localhost; GRANT ALL PRIVILEGES ON test.* TO mysqltest_1@localhost; - ----> connection: bug9504_con1 +connect bug9504_con1,localhost,mysqltest_1,,; use mysqltest1; use mysqltest2; use mysqltest3; @@ -1236,8 +1309,8 @@ mysqltest3.f_def() SELECT mysqltest4.f_inv(); mysqltest4.f_inv() 1 - ----> connection: default +connection default; +disconnect bug9504_con1; DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; DROP DATABASE mysqltest3; @@ -1251,8 +1324,7 @@ GRANT ALL PRIVILEGES ON mysqltest1.* TO mysqltest_1@localhost; GRANT SELECT ON mysqltest2.* TO mysqltest_1@localhost; CREATE PROCEDURE mysqltest1.p1() SQL SECURITY INVOKER SELECT 1; - ----> connection: bug27337_con1 +connect bug27337_con1,localhost,mysqltest_1,,mysqltest2; CREATE TABLE t1(c INT); ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1' CALL mysqltest1.p1(); @@ -1260,14 +1332,14 @@ CALL mysqltest1.p1(); 1 CREATE TABLE t1(c INT); ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1' - ----> connection: bug27337_con2 +disconnect bug27337_con1; +connect bug27337_con2,localhost,mysqltest_1,,mysqltest2; CREATE TABLE t1(c INT); ERROR 42000: CREATE command denied to user 'mysqltest_1'@'localhost' for table 't1' SHOW TABLES; Tables_in_mysqltest2 - ----> connection: default +connection default; +disconnect bug27337_con2; DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; DROP USER mysqltest_1@localhost; @@ -1279,8 +1351,7 @@ CREATE TABLE mysqltest1.t1(c INT); CREATE TABLE mysqltest2.t2(c INT); GRANT SELECT ON mysqltest1.t1 TO mysqltest_1@localhost; GRANT SELECT ON mysqltest2.t2 TO mysqltest_2@localhost; - ----> connection: bug27337_con1 +connect bug27337_con1,localhost,mysqltest_1,,mysqltest1; SHOW TABLES FROM mysqltest1; Tables_in_mysqltest1 t1 @@ -1288,8 +1359,7 @@ PREPARE stmt1 FROM 'SHOW TABLES FROM mysqltest1'; EXECUTE stmt1; Tables_in_mysqltest1 t1 - ----> connection: bug27337_con2 +connect bug27337_con2,localhost,mysqltest_2,,mysqltest2; SHOW COLUMNS FROM mysqltest2.t2; Field Type Null Key Default Extra c int(11) YES NULL @@ -1297,24 +1367,22 @@ PREPARE stmt2 FROM 'SHOW COLUMNS FROM mysqltest2.t2'; EXECUTE stmt2; Field Type Null Key Default Extra c int(11) YES NULL - ----> connection: default +connection default; REVOKE SELECT ON mysqltest1.t1 FROM mysqltest_1@localhost; REVOKE SELECT ON mysqltest2.t2 FROM mysqltest_2@localhost; - ----> connection: bug27337_con1 +connection bug27337_con1; SHOW TABLES FROM mysqltest1; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1' EXECUTE stmt1; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest1' - ----> connection: bug27337_con2 +connection bug27337_con2; SHOW COLUMNS FROM mysqltest2.t2; ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2' EXECUTE stmt2; ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2' - ----> connection: default +connection default; +disconnect bug27337_con1; +disconnect bug27337_con2; DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; DROP USER mysqltest_1@localhost; @@ -1328,6 +1396,8 @@ GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost'; GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost'; USE db27878; CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1; +connect user1,localhost,mysqltest_1,,test; +connection user1; USE db27878; UPDATE v1 SET f2 = 4; ERROR HY000: View 'db27878.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them @@ -1335,6 +1405,8 @@ SELECT * FROM test.t1; f1 f2 1 1 2 2 +disconnect user1; +connection default; REVOKE UPDATE (f1) ON `test`.`t1` FROM 'mysqltest_1'@'localhost'; REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost'; REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost'; @@ -1394,8 +1466,7 @@ GRANT CREATE ROUTINE, EXECUTE ON mysqltest1.* TO testuser@localhost; GRANT SELECT(b) ON t1 TO testuser@localhost; GRANT SELECT ON t2 TO testuser@localhost; GRANT SELECT ON mysqltest2.* TO testuser@localhost; - -# Connection: bug57952_con1 (testuser@localhost, db: mysqltest1) +connect bug57952_con1,localhost,testuser,,mysqltest1; PREPARE s1 FROM 'SELECT b FROM t1'; PREPARE s2 FROM 'SELECT a FROM t2'; PREPARE s3 FROM 'SHOW TABLES FROM mysqltest2'; @@ -1411,14 +1482,12 @@ a CALL p3; Tables_in_mysqltest2 t3 - -# Connection: default +connection default; REVOKE SELECT ON t1 FROM testuser@localhost; GRANT SELECT(a) ON t1 TO testuser@localhost; REVOKE SELECT ON t2 FROM testuser@localhost; REVOKE SELECT ON mysqltest2.* FROM testuser@localhost; - -# Connection: bug57952_con1 (testuser@localhost, db: mysqltest1) +connection bug57952_con1; # - Check column-level privileges... EXECUTE s1; ERROR 42000: SELECT command denied to user 'testuser'@'localhost' for column 'b' in table 't1' @@ -1442,8 +1511,8 @@ EXECUTE s3; ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2' CALL p3; ERROR 42000: Access denied for user 'testuser'@'localhost' to database 'mysqltest2' - -# Connection: default +connection default; +disconnect bug57952_con1; DROP DATABASE mysqltest1; DROP DATABASE mysqltest2; DROP USER testuser@localhost; @@ -1474,28 +1543,26 @@ select db, routine_name, routine_type, proc_priv from mysql.procs_priv where use db routine_name routine_type proc_priv mysqltest1 f1 FUNCTION Execute mysqltest1 p1 PROCEDURE Execute -# -# Create connection 'bug_36544_con1' as 'mysqluser1@localhost'. +connect bug36544_con1,localhost,mysqluser1,,; call mysqltest1.p1(); select mysqltest1.f1(); mysqltest1.f1() 0 -# -# Switch to connection 'default'. +connection default; drop user mysqluser1@localhost; # # Test that dropping of user is properly reflected in # both privilege tables and in in-memory structures. # -# Switch to connection 'bug36544_con1'. +connection bug36544_con1; # The connection cold be alive but should not be able to # access to any of the stored routines. call mysqltest1.p1(); ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1' select mysqltest1.f1(); ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1' -# -# Switch to connection 'default'. +disconnect bug36544_con1; +connection default; # # Now create user with the same name and check that he # has not inherited privileges. @@ -1505,15 +1572,13 @@ Grants for mysqluser1@localhost GRANT USAGE ON *.* TO 'mysqluser1'@'localhost' select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; db routine_name routine_type proc_priv -# -# Create connection 'bug_36544_con2' as 'mysqluser1@localhost'. +connect bug36544_con2,localhost,mysqluser1,,; # Newly created user should not be able to access any of the routines. call mysqltest1.p1(); ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1' select mysqltest1.f1(); ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1' -# -# Switch to connection 'default'. +connection default; # # 2) Check that RENAME USER properly updates privileges on both # stored procedures and functions. @@ -1551,8 +1616,7 @@ select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' db table_name table_priv mysqltest1 t11 Select mysqltest1 t22 Select -# -# Switch to connection 'bug36544_con2'. +connection bug36544_con2; call mysqltest1.p1(); select mysqltest1.f1(); mysqltest1.f1() @@ -1561,13 +1625,12 @@ select * from mysqltest1.t11; i select * from mysqltest1.t22; i -# -# Switch to connection 'default'. +connection default; rename user mysqluser1@localhost to mysqluser10@localhost; # # Test that there are no privileges left for mysqluser1. # -# Switch to connection 'bug36544_con2'. +connection bug36544_con2; # The connection cold be alive but should not be able to # access to any of the stored routines or tables. call mysqltest1.p1(); @@ -1578,8 +1641,8 @@ select * from mysqltest1.t11; ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11' select * from mysqltest1.t22; ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22' -# -# Switch to connection 'default'. +disconnect bug36544_con2; +connection default; # # Now create user with the old name and check that he # has not inherited privileges. @@ -1591,8 +1654,7 @@ select db, routine_name, routine_type, proc_priv from mysql.procs_priv where use db routine_name routine_type proc_priv select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; db table_name table_priv -# -# Create connection 'bug_36544_con3' as 'mysqluser1@localhost'. +connect bug36544_con3,localhost,mysqluser1,,; # Newly created user should not be able to access to any of the # stored routines or tables. call mysqltest1.p1(); @@ -1603,8 +1665,8 @@ select * from mysqltest1.t11; ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11' select * from mysqltest1.t22; ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22' -# -# Switch to connection 'default'. +disconnect bug36544_con3; +connection default; # # Now check that privileges became associated with a new user # name - mysqluser10. @@ -1624,8 +1686,7 @@ select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10 db table_name table_priv mysqltest1 t11 Select mysqltest1 t22 Select -# -# Create connection 'bug_36544_con4' as 'mysqluser10@localhost'. +connect bug36544_con4,localhost,mysqluser10,,; call mysqltest1.p1(); select mysqltest1.f1(); mysqltest1.f1() @@ -1634,8 +1695,8 @@ select * from mysqltest1.t11; i select * from mysqltest1.t22; i -# -# Switch to connection 'default'. +disconnect bug36544_con4; +connection default; # # Clean-up. drop user mysqluser1@localhost; @@ -1656,15 +1717,19 @@ create database mysqltest; use mysqltest; grant create on mysqltest.* to mysqltest@localhost; create table t1 (i INT); +connect user1,localhost,mysqltest,,mysqltest; +connection user1; insert into t1 values (1); ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1' create table t2 (i INT); create table t4 (i INT); +connection default; grant select, insert on mysqltest.t2 to mysqltest@localhost; grant insert on mysqltest.t4 to mysqltest@localhost; grant create, insert on mysqltest.t5 to mysqltest@localhost; grant create, insert on mysqltest.t6 to mysqltest@localhost; flush privileges; +connection user1; insert into t2 values (1); create table if not exists t1 select * from t2; ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1' @@ -1681,6 +1746,7 @@ create table t4 select * from t2; ERROR 42S01: Table 't4' already exists create table t1 select * from t2; ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table 't1' +connection default; drop table t1,t2,t4,t5,t6; revoke create on mysqltest.* from mysqltest@localhost; revoke select, insert on mysqltest.t2 from mysqltest@localhost; @@ -1688,6 +1754,7 @@ revoke insert on mysqltest.t4 from mysqltest@localhost; revoke create, insert on mysqltest.t5 from mysqltest@localhost; revoke create, insert on mysqltest.t6 from mysqltest@localhost; drop user mysqltest@localhost; +disconnect user1; drop database mysqltest; use test; FLUSH PRIVILEGES without procs_priv table. @@ -1711,6 +1778,7 @@ FLUSH PRIVILEGES; CREATE DATABASE dbbug33464; CREATE USER 'userbug33464'@'localhost'; GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost'; +connect connbug33464, localhost, userbug33464, , dbbug33464; userbug33464@localhost dbbug33464 CREATE PROCEDURE sp3(v1 char(20)) @@ -1725,6 +1793,8 @@ CREATE FUNCTION fn2() returns char(50) SQL SECURITY DEFINER BEGIN return 2; END// +disconnect connbug33464; +connection default; USE dbbug33464; root@localhost dbbug33464 @@ -1753,6 +1823,7 @@ SHOW GRANTS FOR 'user1'@'localhost'; Grants for user1@localhost GRANT USAGE ON *.* TO 'user1'@'localhost' GRANT CREATE, CREATE ROUTINE ON `db1`.* TO 'user1'@'localhost' +connect con1,localhost,user1,,; ** Connect as user1 and create a procedure. ** The creation will imply implicitly assigned ** EXECUTE and ALTER ROUTINE privileges to @@ -1769,6 +1840,7 @@ BEGIN SET @x = 0; REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT; END ;|| +connect con2,localhost,user2,,; ** Connect as user2 and create a procedure. ** Implicitly assignment of privileges will ** fail because the user2@localhost is an @@ -1780,6 +1852,7 @@ REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT; END ;|| Warnings: Warning 1404 Failed to grant EXECUTE and ALTER ROUTINE privileges +connection default; SHOW GRANTS FOR 'user1'@'localhost'; Grants for user1@localhost GRANT USAGE ON *.* TO 'user1'@'localhost' @@ -1789,6 +1862,8 @@ SHOW GRANTS FOR 'user2'; Grants for user2@% GRANT USAGE ON *.* TO 'user2'@'%' GRANT CREATE, CREATE ROUTINE ON `db1`.* TO 'user2'@'%' +disconnect con1; +disconnect con2; DROP PROCEDURE db1.proc1; DROP PROCEDURE db1.proc2; REVOKE ALL ON db1.* FROM 'user1'@'localhost'; @@ -1801,6 +1876,7 @@ DROP DATABASE db1; # Bug #25863 No database selected error, but documentation # says * for global allowed # +connect conn1,localhost,root,,*NO-ONE*; GRANT ALL ON * TO mysqltest_1; ERROR 3D000: No database selected GRANT ALL ON *.* TO mysqltest_1; @@ -1820,18 +1896,23 @@ SHOW GRANTS FOR mysqltest_1; Grants for mysqltest_1@% GRANT ALL PRIVILEGES ON *.* TO 'mysqltest_1'@'%' DROP USER mysqltest_1; +connection default; +disconnect conn1; CREATE DATABASE db1; CREATE DATABASE db2; GRANT SELECT ON db1.* to 'testbug'@localhost; USE db2; CREATE TABLE t1 (a INT); USE test; +connect con1,localhost,testbug,,db1; SELECT * FROM `../db2/tb2`; ERROR 42S02: Table 'db1.../db2/tb2' doesn't exist SELECT * FROM `../db2`.tb2; ERROR 42000: SELECT command denied to user 'testbug'@'localhost' for table 'tb2' SELECT * FROM `#mysql50#/../db2/tb2`; ERROR 42000: Incorrect table name '#mysql50#/../db2/tb2' +connection default; +disconnect con1; DROP USER 'testbug'@localhost; DROP TABLE db2.t1; DROP DATABASE db1; @@ -1888,13 +1969,13 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT RELOAD, SHUTDOWN, PROCESS, FILE, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT, CREATE USER ON *.* TO 'mysqltest_u1'@'localhost' GRANT CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE ROUTINE, ALTER ROUTINE, EVENT ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't1' - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -1911,16 +1992,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT SELECT ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -1937,16 +2018,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT INSERT ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -1963,16 +2044,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT UPDATE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -1989,16 +2070,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT DELETE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2015,16 +2096,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT CREATE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2041,16 +2122,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT DROP ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2067,16 +2148,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT ALTER ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2093,16 +2174,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT INDEX ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2119,16 +2200,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT REFERENCES ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2145,16 +2226,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT USAGE ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' WITH GRANT OPTION - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2171,16 +2252,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT CREATE VIEW ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2197,16 +2278,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT SHOW VIEW ON `mysqltest_db1`.* TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2223,16 +2304,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT SELECT ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2249,16 +2330,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT INSERT ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2275,16 +2356,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT UPDATE ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2301,16 +2382,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT DELETE ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2327,16 +2408,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT CREATE ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2353,16 +2434,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT DROP ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2379,16 +2460,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT ALTER ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2405,16 +2486,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT INDEX ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2431,16 +2512,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT REFERENCES ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2457,16 +2538,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT USAGE ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' WITH GRANT OPTION - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2483,16 +2564,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT CREATE VIEW ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2509,16 +2590,16 @@ SHOW GRANTS FOR mysqltest_u1@localhost; Grants for mysqltest_u1@localhost GRANT USAGE ON *.* TO 'mysqltest_u1'@'localhost' GRANT SHOW VIEW ON `mysqltest_db1`.`t1` TO 'mysqltest_u1'@'localhost' - -# connection: con1 (mysqltest_u1@mysqltest_db1) +connect con1,localhost,mysqltest_u1,,mysqltest_db1; +connection con1; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -# connection: default +connection default; +disconnect con1; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost; SHOW GRANTS FOR mysqltest_u1@localhost; @@ -2542,7 +2623,7 @@ DROP DATABASE IF EXISTS secret; DROP DATABASE IF EXISTS no_such_db; CREATE DATABASE secret; GRANT USAGE ON *.* TO untrusted@localhost; -# Connection con1 +connect con1, localhost, untrusted; SHOW GRANTS; Grants for untrusted@localhost GRANT USAGE ON *.* TO 'untrusted'@'localhost' @@ -2557,7 +2638,8 @@ CREATE PROCEDURE no_such_db.foo() BEGIN END; ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'no_such_db' CREATE PROCEDURE secret.peek_at_secret() BEGIN END; ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret' -# Connection default +connection default; +disconnect con1; DROP USER untrusted@localhost; DROP DATABASE secret; # |