summaryrefslogtreecommitdiff
path: root/mysql-test/suite/funcs_1
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/funcs_1')
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc3
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_routines.inc4
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_schemata.inc4
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_tables.inc5
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_triggers.inc5
-rw-r--r--mysql-test/suite/funcs_1/datadict/is_views.inc4
-rw-r--r--mysql-test/suite/funcs_1/datadict/processlist_val.inc60
-rw-r--r--mysql-test/suite/funcs_1/datadict/statistics.inc3
-rw-r--r--mysql-test/suite/funcs_1/datadict/table_constraints.inc2
-rw-r--r--mysql-test/suite/funcs_1/datadict/tables.inc2
-rw-r--r--mysql-test/suite/funcs_1/datadict/tables1.inc2
-rw-r--r--mysql-test/suite/funcs_1/r/charset_collation.result5
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_06.result40
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_storedproc_10.result9
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_03.result92
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_03e.result145
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_0407.result27
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_08.result15
-rw-r--r--mysql-test/suite/funcs_1/r/is_basics_mixed.result27
-rw-r--r--mysql-test/suite/funcs_1/r/is_column_privileges.result38
-rw-r--r--mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns.result8
-rw-r--r--mysql-test/suite/funcs_1/r/is_key_column_usage.result8
-rw-r--r--mysql-test/suite/funcs_1/r/is_routines.result11
-rw-r--r--mysql-test/suite/funcs_1/r/is_schema_privileges.result35
-rw-r--r--mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_schemata.result11
-rw-r--r--mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result4
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics.result18
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics_is.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics_mysql.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints_is.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_table_privileges.result11
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_innodb.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_is.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_is_embedded.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_memory.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_myisam.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_mysql.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result5
-rw-r--r--mysql-test/suite/funcs_1/r/is_triggers.result14
-rw-r--r--mysql-test/suite/funcs_1/r/is_user_privileges.result27
-rw-r--r--mysql-test/suite/funcs_1/r/is_views.result11
-rw-r--r--mysql-test/suite/funcs_1/r/memory_storedproc_06.result40
-rw-r--r--mysql-test/suite/funcs_1/r/memory_storedproc_10.result9
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_03.result92
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_03e.result139
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_0407.result27
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_08.result15
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_storedproc_06.result40
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_storedproc_10.result9
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_03.result92
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_03e.result139
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_0407.result27
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_08.result15
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result42
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_priv_ps.result42
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_val_no_prot.result61
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_val_ps.result61
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result5
-rw-r--r--mysql-test/suite/funcs_1/storedproc/storedproc_10.inc2
-rw-r--r--mysql-test/suite/funcs_1/t/charset_collation.test3
-rw-r--r--mysql-test/suite/funcs_1/t/is_basics_mixed.test11
-rw-r--r--mysql-test/suite/funcs_1/t/is_column_privileges.test17
-rw-r--r--mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test2
-rw-r--r--mysql-test/suite/funcs_1/t/is_columns.test3
-rw-r--r--mysql-test/suite/funcs_1/t/is_schema_privileges.test21
-rw-r--r--mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test3
-rw-r--r--mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test3
-rw-r--r--mysql-test/suite/funcs_1/t/is_statistics.test8
-rw-r--r--mysql-test/suite/funcs_1/t/is_table_constraints.test2
-rw-r--r--mysql-test/suite/funcs_1/t/is_table_privileges.test4
-rw-r--r--mysql-test/suite/funcs_1/t/is_user_privileges.test12
79 files changed, 1289 insertions, 402 deletions
diff --git a/mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc b/mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc
index 098b8c6eca2..ee8a923485a 100644
--- a/mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_key_column_usage.inc
@@ -125,18 +125,15 @@ ORDER BY constraint_catalog, constraint_schema, constraint_name,
# show view of user root
eval $select;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
eval $select;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
eval $select;
# Cleanup
---echo # Switch to connection default and close connections testuser1, testuser2
connection default;
disconnect testuser1;
disconnect testuser2;
diff --git a/mysql-test/suite/funcs_1/datadict/is_routines.inc b/mysql-test/suite/funcs_1/datadict/is_routines.inc
index ecbb1b8c0da..a6e0931ca42 100644
--- a/mysql-test/suite/funcs_1/datadict/is_routines.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_routines.inc
@@ -180,26 +180,22 @@ TO 'testuser2'@'localhost';
GRANT EXECUTE ON db_datadict_2.* TO 'testuser2'@'localhost';
FLUSH PRIVILEGES;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
--replace_column 24 "YYYY-MM-DD hh:mm:ss" 25 "YYYY-MM-DD hh:mm:ss"
SELECT * FROM information_schema.routines;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
--replace_column 24 "YYYY-MM-DD hh:mm:ss" 25 "YYYY-MM-DD hh:mm:ss"
SELECT * FROM information_schema.routines;
---echo # Establish connection testuser3 (user=testuser3)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser3, localhost, testuser3, , test);
--replace_column 24 "YYYY-MM-DD hh:mm:ss" 25 "YYYY-MM-DD hh:mm:ss"
SELECT * FROM information_schema.routines;
# Cleanup
---echo # Switch to connection default and close connections testuser1,testuser2,testuser3
connection default;
disconnect testuser1;
disconnect testuser2;
diff --git a/mysql-test/suite/funcs_1/datadict/is_schemata.inc b/mysql-test/suite/funcs_1/datadict/is_schemata.inc
index 29e1f6af4ef..18c759b91d1 100644
--- a/mysql-test/suite/funcs_1/datadict/is_schemata.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_schemata.inc
@@ -103,7 +103,6 @@ eval $my_select;
--sorted_result
eval $my_show;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict_1);
# Shows db_datadict_1
@@ -111,7 +110,6 @@ eval $my_select;
--sorted_result
eval $my_show;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict_2);
# Shows db_datadict_1 and db_datadict_2
@@ -119,7 +117,6 @@ eval $my_select;
--sorted_result
eval $my_show;
---echo # Establish connection testuser3 (user=testuser3)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser3, localhost, testuser3, , test);
# Shows neither db_datadict_1 nor db_datadict_2
@@ -128,7 +125,6 @@ eval $my_select;
eval $my_show;
# Cleanup
---echo # Switch to connection default and close connections testuser1,testuser2,testuser3
connection default;
disconnect testuser1;
disconnect testuser2;
diff --git a/mysql-test/suite/funcs_1/datadict/is_tables.inc b/mysql-test/suite/funcs_1/datadict/is_tables.inc
index 0177ca05e50..de0681d952b 100644
--- a/mysql-test/suite/funcs_1/datadict/is_tables.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_tables.inc
@@ -129,7 +129,6 @@ let $my_select = SELECT * FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name;
let $my_show = SHOW TABLES FROM db_datadict;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
# tb2 is not granted to anyone
@@ -182,7 +181,6 @@ eval $my_select;
--sorted_result
eval $my_show;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
if ($have_bug_32285)
@@ -195,7 +193,6 @@ eval $my_select;
--sorted_result
eval $my_show;
---echo # Establish connection testuser3 (user=testuser3)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser3, localhost, testuser3, , db_datadict);
if ($have_bug_32285)
@@ -208,7 +205,6 @@ eval $my_select;
--sorted_result
eval $my_show;
---echo # Switch to connection default (user=root)
connection default;
# we see only 'public' tables
if ($have_bug_32285)
@@ -222,7 +218,6 @@ eval $my_select;
eval $my_show;
# Cleanup
---echo # Close connection testuser1, testuser2, testuser3
disconnect testuser1;
disconnect testuser2;
disconnect testuser3;
diff --git a/mysql-test/suite/funcs_1/datadict/is_triggers.inc b/mysql-test/suite/funcs_1/datadict/is_triggers.inc
index 6c618e533b2..cb2c461dd39 100644
--- a/mysql-test/suite/funcs_1/datadict/is_triggers.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_triggers.inc
@@ -123,7 +123,6 @@ GRANT ALL ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
let $my_select = SELECT * FROM information_schema.triggers
WHERE trigger_name = 'trg1';
let $my_show = SHOW TRIGGERS FROM db_datadict;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
--replace_result $engine_type <engine_type>
@@ -138,7 +137,6 @@ GRANT SELECT ON db_datadict.t1 TO 'testuser3'@'localhost';
eval $my_select;
eval $my_show;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
SHOW GRANTS FOR 'testuser2'@'localhost';
@@ -146,7 +144,6 @@ SHOW GRANTS FOR 'testuser2'@'localhost';
eval $my_select;
eval $my_show;
---echo # Establish connection testuser3 (user=testuser3)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser3, localhost, testuser3, , test);
SHOW GRANTS FOR 'testuser3'@'localhost';
@@ -154,7 +151,6 @@ SHOW GRANTS FOR 'testuser3'@'localhost';
eval $my_select;
eval $my_show;
---echo # Establish connection testuser4 (user=testuser4)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser4, localhost, testuser4, , test);
SHOW GRANTS FOR 'testuser4'@'localhost';
@@ -165,7 +161,6 @@ DESC db_datadict.t1;
eval $my_select;
eval $my_show;
---echo # Switch to connection default and close connections testuser1 - testuser4
connection default;
disconnect testuser1;
disconnect testuser2;
diff --git a/mysql-test/suite/funcs_1/datadict/is_views.inc b/mysql-test/suite/funcs_1/datadict/is_views.inc
index 716d50f5794..3330bea4462 100644
--- a/mysql-test/suite/funcs_1/datadict/is_views.inc
+++ b/mysql-test/suite/funcs_1/datadict/is_views.inc
@@ -108,23 +108,19 @@ let $select = SELECT * FROM information_schema.views
WHERE table_schema = 'db_datadict' ORDER BY table_name;
eval $select;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , test);
eval $select;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , test);
eval $select;
---echo # Establish connection test_no_views (user=test_no_views)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (test_no_views, localhost, test_no_views, , test);
eval $select;
# Cleanup
---echo # Switch to connection default and close all other connections
connection default;
disconnect testuser1;
disconnect testuser2;
diff --git a/mysql-test/suite/funcs_1/datadict/processlist_val.inc b/mysql-test/suite/funcs_1/datadict/processlist_val.inc
index 6e76cedde2e..cfc3c5e751a 100644
--- a/mysql-test/suite/funcs_1/datadict/processlist_val.inc
+++ b/mysql-test/suite/funcs_1/datadict/processlist_val.inc
@@ -135,14 +135,8 @@ echo
# Ensure that the information about an inactive connection is correct.
#--------------------------------------------------------------------------
;
-echo
-# ----- establish connection con1 (user = test_user) -----
-;
connect (con1,localhost,test_user,ddictpass,information_schema);
#
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
# We have now a second connection.
# First working phase for the new connection is with Command = 'Connect'.
@@ -206,9 +200,6 @@ echo
# because he has not the PROCESS privilege.
#----------------------------------------------------------------------------
;
-echo
-# ----- switch to connection con1 (user = test_user) -----
-;
connection con1;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
@@ -220,13 +211,7 @@ echo
# Ensure that the user test_user sees all connections with his username.
#----------------------------------------------------------------------------
;
-echo
------ establish connection con2 (user = test_user) ------
-;
connect (con2,localhost,test_user,ddictpass,information_schema);
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
# If the testing box is under heavy load we might see within some of the
# next queries connection
@@ -239,9 +224,6 @@ echo
let $wait_condition= SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE USER = 'test_user' AND COMMAND = 'Sleep' AND STATE = '';
--source include/wait_condition.inc
-echo
-# ----- switch to connection con2 (user = test_user) -----
-;
connection con2;
# Just dump what we get
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME> 9 <TIME_MS> 13 <MEMORY> 14 <ROWS> 15 <QUERY_ID> 17 <TID>
@@ -249,9 +231,6 @@ SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
SHOW FULL PROCESSLIST;
#
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
# Pull the ID of con2, we will need it later
SELECT ID INTO @test_user_con2_id FROM INFORMATION_SCHEMA.PROCESSLIST
@@ -263,9 +242,6 @@ echo
# Ensure we get correct information about a connection during work
#----------------------------------------------------------------------------
;
-echo
-# ----- switch to connection con2 (user = test_user) -----
-;
connection con2;
# "Organise" a long running command to be observed by the root user.
echo
@@ -283,9 +259,6 @@ SELECT sleep(10), 17;
send;
eval $sleep_command;
#
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
echo
# Poll till connection con2 is in state 'User sleep'.
@@ -324,17 +297,11 @@ let $wait_timeout= 10;
let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID = @test_user_con2_id AND INFO IS NOT NULL AND TIME > @time;
--source include/wait_condition.inc
-echo
-# ----- switch to connection con2 (user = testuser) -----
-;
connection con2;
echo
# Pull("reap") the result set from the statement executed with "send".
;
reap;
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
echo
# Poll till all connections of 'test_user' are in a state with COMMAND = 'Sleep'
@@ -352,9 +319,6 @@ echo
;
LOCK TABLE test.t1 WRITE;
#
-echo
-# ----- switch to connection con2 (user = test_user) -----
-;
connection con2;
echo
# Send a statement to the server, but do not wait till the result
@@ -362,9 +326,6 @@ echo
;
send
SELECT COUNT(*) FROM test.t1;
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
echo
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
@@ -379,9 +340,6 @@ let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
UNLOCK TABLES;
#
-echo
-# ----- switch to connection con2 (user = test_user) -----
-;
connection con2;
echo
# Pull("reap") the result set from the statement executed with "send".
@@ -395,15 +353,9 @@ echo
;
# We do not want to waste runtime, therefore we run the following test based
# on "Lock collision" and not with some "sleep(10)".
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
LOCK TABLE test.t1 WRITE;
#
-echo
-# ----- switch to connection con2 (user = test_user) -----
-;
connection con2;
echo
# Send a long (~20 KB code) statement to the server, but do not wait
@@ -417,9 +369,6 @@ let $my_statement =
SELECT count(*),'$string' AS "Long string" FROM test.t1;
send;
eval $my_statement;
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
echo
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
@@ -441,9 +390,6 @@ SHOW FULL PROCESSLIST;
--replace_column 1 <ID> 3 <HOST_NAME> 5 <COMMAND> 6 <TIME> 7 <STATE>
SHOW PROCESSLIST;
UNLOCK TABLES;
-echo
-# ----- switch to connection con2 (user = test_user) -----
-;
connection con2;
echo
# Pull("reap") the result set from the monster statement executed with "send".
@@ -452,13 +398,7 @@ reap;
# Cleanup
-echo
-# ----- switch to connection default (user = root) -----
-;
connection default;
-echo
------ disconnect con1 and con2 -----
-;
disconnect con1;
disconnect con2;
DROP USER test_user@'localhost';
diff --git a/mysql-test/suite/funcs_1/datadict/statistics.inc b/mysql-test/suite/funcs_1/datadict/statistics.inc
index 00fd7a1b06b..56a291a59bb 100644
--- a/mysql-test/suite/funcs_1/datadict/statistics.inc
+++ b/mysql-test/suite/funcs_1/datadict/statistics.inc
@@ -41,15 +41,12 @@ ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
--replace_column 10 #CARD#
eval $my_select;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1,localhost,testuser1,,db_datadict);
--replace_column 10 #CARD#
eval $my_select;
---echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
-
diff --git a/mysql-test/suite/funcs_1/datadict/table_constraints.inc b/mysql-test/suite/funcs_1/datadict/table_constraints.inc
index 9e57976862b..74e4c038876 100644
--- a/mysql-test/suite/funcs_1/datadict/table_constraints.inc
+++ b/mysql-test/suite/funcs_1/datadict/table_constraints.inc
@@ -32,12 +32,10 @@ WHERE table_schema = '$table_schema'
ORDER BY table_schema,table_name,constraint_name;
eval $my_select;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1,localhost,testuser1,,db_datadict);
eval $my_select;
---echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
diff --git a/mysql-test/suite/funcs_1/datadict/tables.inc b/mysql-test/suite/funcs_1/datadict/tables.inc
index 5aa072d184c..5c83b11eb66 100644
--- a/mysql-test/suite/funcs_1/datadict/tables.inc
+++ b/mysql-test/suite/funcs_1/datadict/tables.inc
@@ -36,7 +36,6 @@ DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1,localhost,testuser1,,test1);
--source suite/funcs_1/datadict/tables2.inc
@@ -46,7 +45,6 @@ SHOW TABLES FROM test1;
SHOW TABLES FROM test2;
--enable_abort_on_error
---echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
diff --git a/mysql-test/suite/funcs_1/datadict/tables1.inc b/mysql-test/suite/funcs_1/datadict/tables1.inc
index 2e054a9dcfb..36a4ee568f4 100644
--- a/mysql-test/suite/funcs_1/datadict/tables1.inc
+++ b/mysql-test/suite/funcs_1/datadict/tables1.inc
@@ -26,12 +26,10 @@ DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1,localhost,testuser1,,test1);
--source suite/funcs_1/datadict/tables2.inc
---echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER testuser1@localhost;
diff --git a/mysql-test/suite/funcs_1/r/charset_collation.result b/mysql-test/suite/funcs_1/r/charset_collation.result
index b3183ba48e1..31bd30c5acf 100644
--- a/mysql-test/suite/funcs_1/r/charset_collation.result
+++ b/mysql-test/suite/funcs_1/r/charset_collation.result
@@ -1,6 +1,6 @@
DROP USER dbdict_test@localhost;
CREATE USER dbdict_test@localhost;
-# Establish connection con (user=dbdict_test)
+connect con,localhost,dbdict_test,,;
SELECT *
FROM information_schema.character_sets
@@ -36,5 +36,6 @@ latin1_bin latin1
latin1_general_ci latin1
utf8_bin utf8
utf8_general_ci utf8
-# Switch to connection default + disconnect con
+connection default;
+disconnect con;
DROP USER dbdict_test@localhost;
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
index 1131477869a..2cf079a75f8 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result
@@ -66,6 +66,7 @@ load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t11;
Section 3.1.6 - Privilege Checks:
--------------------------------------------------------------------------------
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -80,6 +81,7 @@ grant all on db_storedproc_1.* to 'user_1'@'localhost';
revoke create routine on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS sp1;
+connect user1a, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -88,10 +90,13 @@ BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
ERROR 42000: Access denied for user 'user_1'@'localhost' to database 'db_storedproc_1'
+disconnect user1a;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
+connect user1b, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -99,6 +104,8 @@ CREATE PROCEDURE sp1(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
+disconnect user1b;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -114,6 +121,7 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
+connect user2, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3(v1 char(20))
@@ -124,6 +132,8 @@ CREATE FUNCTION fn1(v1 int) returns int
BEGIN
return v1;
END//
+disconnect user2;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -146,6 +156,7 @@ CREATE PROCEDURE sp4(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
+connect user3, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -167,6 +178,8 @@ SQL_DATA_ACCESS CONTAINS SQL
SECURITY_TYPE DEFINER
SQL_MODE
ROUTINE_COMMENT
+disconnect user3;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp4;
@@ -187,6 +200,7 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
flush privileges;
+connect user5_1, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp5_s_i () sql security definer
@@ -202,6 +216,8 @@ CREATE PROCEDURE sp5_ins () sql security definer
BEGIN
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_ins', 1000);
END//
+disconnect user5_1;
+connect user5_2, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -210,12 +226,14 @@ CALL sp5_ins();
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+connection default;
root@localhost db_storedproc_1
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
grant insert on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -223,12 +241,14 @@ ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165
CALL sp5_ins();
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+connection default;
root@localhost db_storedproc_1
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
grant SELECT on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -242,10 +262,12 @@ inserted outside of SP NULL
inserted from sp5_ins 2000-10-00
inserted from sp5_s_i 2000-10-00
inserted from sp5_ins 2000-10-00
+connection default;
root@localhost db_storedproc_1
REVOKE INSERT on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -263,10 +285,12 @@ inserted outside of SP NULL
inserted from sp5_ins 2000-10-00
inserted from sp5_s_i 2000-10-00
inserted from sp5_ins 2000-10-00
+connection default;
root@localhost db_storedproc_1
REVOKE SELECT on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -275,6 +299,8 @@ CALL sp5_ins();
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+disconnect user5_2;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp5_s_i;
@@ -299,6 +325,7 @@ GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_1, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3166_s_i () SQL SECURITY INVOKER
@@ -314,6 +341,8 @@ CREATE PROCEDURE sp3166_ins () SQL SECURITY INVOKER
BEGIN
insert into db_storedproc_1.t3166 values ('inserted from sp3166_ins');
END//
+disconnect user6_1;
+connect user6_2, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -325,6 +354,7 @@ ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166
CALL sp3166_sel();
c1
inserted outside SP
+connection default;
root@localhost db_storedproc_1
CALL sp3166_sel();
@@ -332,6 +362,8 @@ c1
inserted outside SP
GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+disconnect user6_2;
+connect user6_3, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -343,6 +375,8 @@ c1
inserted outside SP
inserted from sp3166_s_i
inserted from sp3166_ins
+disconnect user6_3;
+connection default;
root@localhost db_storedproc_1
CALL sp3166_sel();
@@ -352,6 +386,7 @@ inserted from sp3166_s_i
inserted from sp3166_ins
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_4, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -359,6 +394,8 @@ ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166
CALL sp3166_ins();
CALL sp3166_sel();
ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166'
+disconnect user6_4;
+connection default;
CALL sp3166_s_i();
c1
inserted outside SP
@@ -369,6 +406,7 @@ inserted from sp3166_ins
root@localhost db_storedproc_1
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_5, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -377,6 +415,8 @@ CALL sp3166_ins();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_ins'
CALL sp3166_sel();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_sel'
+disconnect user6_5;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp3166_s_i;
diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result
index d731979a095..0d846a019dd 100644
--- a/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result
+++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_10.result
@@ -81,6 +81,7 @@ create user 'user_2'@'localhost';
GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user2_1, localhost, user_1, , db_storedproc;
user_1@localhost db_storedproc
CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER
@@ -93,6 +94,8 @@ DECLARE res INT;
SET res = n * n;
RETURN res;
END//
+disconnect user2_1;
+connect user2_2, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
@@ -111,6 +114,8 @@ fn31105( 9 )
81
GRANT EXECUTE ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+disconnect user2_2;
+connect user2_3, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
@@ -119,6 +124,7 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
+disconnect user2_3;
connection default;
USE db_storedproc;
@@ -131,12 +137,15 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
+connect user2_4, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
SELECT fn31105( 9 );
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
+disconnect user2_4;
+connection default;
USE db_storedproc;
root@localhost db_storedproc
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03.result b/mysql-test/suite/funcs_1/r/innodb_trig_03.result
index 5edef4cf3af..98f599da3e5 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result
@@ -86,9 +86,13 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.3.2:
-----------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -96,17 +100,20 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.2_1-no';
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.2-no');
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.2_2-yes';
+connection default;
select current_user;
current_user
root@localhost
@@ -125,9 +132,11 @@ trig 3.5.3.2_2-yes
Testcase 3.5.3.6:
-----------------
+connection no_privs;
use priv_db;
drop trigger trg1_2;
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.6-yes');
select f1 from t1 order by f1;
@@ -135,8 +144,10 @@ f1
insert 3.5.3.2-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
+connection yes_privs;
use priv_db;
drop trigger trg1_2;
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.6-no');
select f1 from t1 order by f1;
@@ -145,7 +156,10 @@ insert 3.5.3.2-no
insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
+connection default;
drop trigger trg1_2;
+disconnect no_privs;
+disconnect yes_privs;
Testcase 3.5.3.7a:
------------------
@@ -160,6 +174,9 @@ grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect no_privs_424a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection no_privs_424a;
select current_user;
current_user
test_noprivs@localhost
@@ -175,6 +192,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
create trigger trg4a_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1a';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1a');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -184,6 +202,7 @@ insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
drop trigger trg4a_1;
+connection yes_privs_424a;
use priv_db;
select current_user;
current_user
@@ -193,6 +212,7 @@ Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg4a_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2a';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2b');
select f1 from t1 order by f1;
f1
@@ -202,6 +222,8 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
drop trigger trg4a_2;
+disconnect no_privs_424a;
+disconnect yes_privs_424a;
Testcase 3.5.3.7b:
------------------
@@ -219,6 +241,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
+connect no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424b;
show grants;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -226,6 +252,7 @@ GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEM
use priv_db;
create trigger trg4b_1 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-1b';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1b');
select f1 from t1 order by f1;
f1
@@ -246,6 +273,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
drop trigger trg4b_1;
+connection yes_privs_424b;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -253,6 +281,7 @@ GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4b_2 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-2b';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2b');
select f1 from t1 order by f1;
f1
@@ -274,6 +303,8 @@ trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
drop trigger trg4b_2;
+disconnect no_privs_424b;
+disconnect yes_privs_424b;
Testcase 3.5.3.7c
-----------------
@@ -291,6 +322,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs_424c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424c;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -298,6 +333,7 @@ GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIE
use priv_db;
create trigger trg4c_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1c';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1c');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -310,6 +346,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
drop trigger trg4c_1;
+connection yes_privs_424c;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -317,6 +354,7 @@ GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4c_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2c';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2c');
select f1 from t1 order by f1;
f1
@@ -329,6 +367,8 @@ trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
drop trigger trg4c_2;
+disconnect no_privs_424c;
+disconnect yes_privs_424c;
Testcase 3.5.3.7d:
------------------
@@ -344,6 +384,10 @@ grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs;
Grants for test_noprivs@%
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
+connect no_privs_424d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424d;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -351,6 +395,7 @@ GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
create trigger trg4d_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1d';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1d');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -364,6 +409,7 @@ trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
drop trigger trg4d_1;
+connection yes_privs_424d;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -371,6 +417,7 @@ GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4d_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2d';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2d');
select f1 from t1 order by f1;
f1
@@ -384,6 +431,8 @@ trig 3.5.3.7-2b
trig 3.5.3.7-2c
trig 3.5.3.7-2d
drop trigger trg4d_2;
+disconnect no_privs_424d;
+disconnect yes_privs_424d;
Testcase 3.5.3.8a:
------------------
@@ -398,6 +447,10 @@ grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect no_privs_425a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425a;
select current_user;
current_user
test_noprivs@localhost
@@ -407,6 +460,7 @@ Grants for test_noprivs@localhost
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg5a_1 before INSERT on t1 for each row
set @test_var = new.f1;
+connection default;
set @test_var = 'before trig 3.5.3.8-1a';
select @test_var;
@test_var
@@ -417,6 +471,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1a
drop trigger trg5a_1;
+connection yes_privs_425a;
use priv_db;
select current_user;
current_user
@@ -426,6 +481,7 @@ Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg5a_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-2a';
select @test_var;
@test_var
@@ -435,6 +491,8 @@ select @test_var;
@test_var
insert 3.5.3.8-2a
drop trigger trg5a_2;
+disconnect no_privs_425a;
+disconnect yes_privs_425a;
Testcase: 3.5.3.8b
------------------
@@ -453,6 +511,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
+connect no_privs_425b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425b;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -460,6 +522,7 @@ GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEM
use priv_db;
create trigger trg5b_1 before UPDATE on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-1b';
insert into t1 (f1) values ('insert 3.5.3.8-1b');
select @test_var;
@@ -471,6 +534,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1b
drop trigger trg5b_1;
+connection yes_privs_425b;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -478,6 +542,7 @@ GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5b_2 before UPDATE on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-2b';
insert into t1 (f1) values ('insert 3.5.3.8-2b');
select @test_var;
@@ -488,6 +553,8 @@ select @test_var;
@test_var
update 3.5.3.8-2b
drop trigger trg5b_2;
+disconnect no_privs_425b;
+disconnect yes_privs_425b;
Testcase 3.5.3.8c:
------------------
@@ -506,6 +573,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs_425c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425c;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -513,6 +584,7 @@ GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIE
use priv_db;
create trigger trg5c_1 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-1c';
insert into t1 (f1) values ('insert 3.5.3.8-1c');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
@@ -520,6 +592,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1c
drop trigger trg5c_1;
+connection yes_privs_425c;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -527,12 +600,15 @@ GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5c_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-2c';
insert into t1 (f1) values ('insert 3.5.3.8-2c');
select @test_var;
@test_var
insert 3.5.3.8-2c
drop trigger trg5c_2;
+disconnect no_privs_425c;
+disconnect yes_privs_425c;
Testcase: 3.5.3.8d:
-------------------
@@ -550,6 +626,10 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
+connect no_privs_425d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425d;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -557,6 +637,7 @@ GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
create trigger trg5d_1 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-1d';
insert into t1 (f1) values ('insert 3.5.3.8-1d');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
@@ -564,6 +645,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1d
drop trigger trg5d_1;
+connection yes_privs_425d;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -571,6 +653,7 @@ GRANT SELECT (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5d_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-2d';
insert into t1 (f1) values ('insert 3.5.3.8-2d');
select @test_var;
@@ -594,12 +677,15 @@ Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect yes_353x,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection yes_353x;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1 before insert on t1 for each row
insert into t2 values (new.f1);
+connection default;
use priv_db;
insert into t1 (f1) values (4);
ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -612,10 +698,12 @@ f1
select f2 from t2 order by f2;
f2
4
+connection yes_353x;
use priv_db;
drop trigger trg1;
create trigger trg2 before insert on t1 for each row
update t2 set f2=new.f1-1;
+connection default;
use priv_db;
insert into t1 (f1) values (2);
ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -629,10 +717,12 @@ f1
select f2 from t2 order by f2;
f2
1
+connection yes_353x;
use priv_db;
drop trigger trg2;
create trigger trg3 before insert on t1 for each row
select f2 into @aaa from t2 where f2=new.f1;
+connection default;
use priv_db;
insert into t1 (f1) values (1);
ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -650,10 +740,12 @@ f2
select @aaa;
@aaa
1
+connection yes_353x;
use priv_db;
drop trigger trg3;
create trigger trg4 before insert on t1 for each row
delete from t2;
+connection default;
use priv_db;
insert into t1 (f1) values (1);
ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2'
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
index 6d8bba4714b..e44e17c6392 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result
@@ -24,6 +24,7 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT ON `priv_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
no trigger privilege on db level for create:
--------------------------------------------
@@ -31,11 +32,13 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv_db;
insert into t1 (f1) values ('insert-yes');
select f1 from t1 order by f1;
f1
insert-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -47,12 +50,14 @@ GRANT SELECT, TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
-----------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -62,6 +67,7 @@ ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for colum
select f1 from t1 order by f1;
f1
insert-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -72,6 +78,7 @@ select f1 from t1 order by f1;
f1
insert-yes
trig 1_2-yes
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -82,6 +89,7 @@ f1
insert-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -93,12 +101,14 @@ GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
no trigger privilege on db level for drop:
------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
drop trigger trg1_2;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -116,10 +126,12 @@ trig 1_2-yes
trigger privilege at activation time:
-------------------------------------
+connection default;
select current_user;
current_user
root@localhost
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -134,6 +146,7 @@ trig 1_2-yes
trigger privilege on db level for drop:
---------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -148,6 +161,7 @@ takes effect after use priv_db:
-------------------------------
use priv_db;
drop trigger trg1_2;
+connection default;
select current_user;
current_user
root@localhost
@@ -174,6 +188,7 @@ GRANT SELECT, UPDATE ON `no_priv_db`.* TO 'test_yesprivs'@'localhost'
use db with trigger privilege on db level and without...:
---------------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -191,6 +206,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
use priv_db;
create trigger trg1_4 before UPDATE on t1 for each row
set new.f1 = 'trig 1_4-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -216,6 +232,8 @@ trig 1_2-yes
trig 1_2-yes
trig 1_3-yes
trig 1_3-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -229,6 +247,8 @@ drop trigger trg1_4;
ERROR HY000: Trigger does not exist
use priv_db;
drop trigger trg1_4;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -251,9 +271,12 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
create User test_noprivs@localhost;
set password for test_noprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
no trigger privilege on table level for create:
-----------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -269,6 +292,7 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -279,6 +303,7 @@ t1
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -287,6 +312,7 @@ insert into t1 (f1) values ('insert1-yes');
select f1 from t1 order by f1;
f1
insert1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -308,6 +334,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca
trigger privilege on table level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -315,6 +342,7 @@ show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -324,6 +352,7 @@ f1
insert1-yes
insert2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -342,6 +371,7 @@ GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
no trigger privilege on table level for drop:
---------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -350,6 +380,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
no trigger privilege at activation time:
----------------------------------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -361,6 +392,7 @@ insert1-yes
insert2-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -368,6 +400,7 @@ grant TRIGGER on priv_db.t1 to test_yesprivs@localhost;
trigger privilege at activation time:
-------------------------------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -382,6 +415,7 @@ trig 1_2-yes
trigger privilege on table level for drop:
------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -390,6 +424,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
drop trigger trg1_2;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -402,6 +437,7 @@ insert7-yes
trig 1_2-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -434,6 +470,7 @@ GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t2` TO 'test_noprivs'@'localhost'
use table with trigger privilege and without...:
------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -451,6 +488,7 @@ show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -469,6 +507,8 @@ trig 1_2-yes
trig 1_2-yes
trig 1_2-yes
trig 1_3-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -478,6 +518,8 @@ drop trigger trg1_3;
drop trigger trg2_2;
ERROR HY000: Trigger does not exist
drop trigger trg1_4;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -509,6 +551,9 @@ grant SELECT,INSERT on *.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT SELECT, INSERT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -532,6 +577,7 @@ f1
trig 1_1-yes
trig 1_1-yes
drop trigger priv_db.trg1_5;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -542,6 +588,7 @@ f1
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -557,6 +604,8 @@ revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+disconnect yes_privs;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_yesprivs@localhost
@@ -567,6 +616,7 @@ select * from information_schema.triggers;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
drop trigger trg1_1;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -579,12 +629,14 @@ use priv_db;
no trigger privilege on db level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -597,6 +649,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -608,6 +661,7 @@ GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
-----------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -625,6 +679,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
create trigger priv_db.trg1_9 before UPDATE on priv_db.t1
for each row
set new.f1 = 'trig 1_9-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -645,6 +700,7 @@ f1
insert-yes
drop trigger priv_db.trg1_9;
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -665,6 +721,7 @@ grant TRIGGER on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT ALL PRIVILEGES ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -672,6 +729,7 @@ use no_priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -692,12 +750,16 @@ select f1 from t1 order by f1;
f1
insert-yes
insert-yes
+disconnect yes_privs;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_yesprivs@localhost
use no_priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+disconnect yes_privs;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -720,6 +782,8 @@ f1
insert-yes
insert-yes
trig 1_2-yes
+disconnect no_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -760,11 +824,14 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO 'test_noprivs'@'localhost'
GRANT SELECT, INSERT ON `priv2_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv1_db;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv1_db;
trigger privilege on one db1 db level, not on db2
-------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -777,6 +844,7 @@ use priv2_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig1_1-yes';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -811,6 +879,7 @@ trig 2_1-yes
revoke trigger privilege on table level (not existing)
------------------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -822,6 +891,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT ALL PRIVILEGES ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -832,6 +902,7 @@ ERROR HY000: Trigger does not exist
use priv1_db;
drop trigger trg1_1;
drop trigger trg2_1;
+connection default;
select current_user;
current_user
root@localhost
@@ -840,6 +911,7 @@ revoke TRIGGER on priv1_db.* from test_yesprivs@localhost;
no trigger privilege on table level for create:
-----------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -847,6 +919,7 @@ use priv1_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -862,6 +935,7 @@ GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
trigger privilege on table level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -872,6 +946,7 @@ set new.f1 = 'trig 1_2-yes';
create trigger trg2_1 before INSERT on t2 for each row
set new.f1 = 'trig 2_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -894,6 +969,7 @@ f1
insert1_yes
insert21-yes
insert22-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -904,6 +980,7 @@ GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C4973
GRANT ALL PRIVILEGES ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -913,6 +990,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
use priv1_db;
create trigger trg2_1 before INSERT on t2 for each row
set new.f1 = 'trig 2_1-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -948,11 +1026,15 @@ trig 2_1-yes
trig 2_1-yes
trig 2_1-yes
trig 2_1-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
drop trigger trg1_2;
drop trigger trg2_1;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -973,6 +1055,8 @@ create User test_useprivs@localhost;
set password for test_useprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
select current_user;
current_user
root@localhost
@@ -987,6 +1071,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1000,6 +1085,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')';
+connect use_privs,localhost,test_useprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_useprivs@localhost
@@ -1010,6 +1096,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1018,6 +1105,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1028,6 +1116,7 @@ f1
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert4-no'')';
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1038,6 +1127,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1046,6 +1136,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1056,6 +1147,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert6-no'')';
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1067,6 +1159,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert7-no'')';
+connection default;
select current_user;
current_user
root@localhost
@@ -1075,6 +1168,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1086,6 +1180,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1097,6 +1192,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1105,6 +1201,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1116,6 +1213,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1128,6 +1226,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1136,6 +1235,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1150,6 +1250,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
deallocate prepare ins1;
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1164,6 +1265,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
deallocate prepare ins1;
+connection default;
select current_user;
current_user
root@localhost
@@ -1172,13 +1274,17 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
drop trigger trg1_1;
+connection default;
select current_user;
current_user
root@localhost
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -1195,6 +1301,8 @@ create table t1 (f1 char(20)) engine= innodb;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
select current_user;
current_user
root@localhost
@@ -1209,6 +1317,7 @@ before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
grant select, insert, update
on priv_db.t1 to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1219,6 +1328,7 @@ select f1 from t1 order by f1;
f1
drop trigger trg1_0;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -1228,6 +1338,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1256,11 +1367,13 @@ select f1 from t1 order by f1;
f1
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
grant trigger on priv_db.* to test_yesprivs@localhost
with grant option;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1273,9 +1386,12 @@ create definer=not_ex_user@localhost trigger trg1_3
after UPDATE on t1 for each row
set @var1 = 'trig 1_3-yes';
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+connection default;
select current_user;
current_user
root@localhost
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -1291,6 +1407,8 @@ create table t1 (f1 char(20)) engine= innodb;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
select current_user;
current_user
root@localhost
@@ -1300,6 +1418,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1329,9 +1448,12 @@ ERROR HY000: Trigger does not exist
drop trigger trg1_2;
commit work;
set autocommit=1;
+connection default;
select current_user;
current_user
root@localhost
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -1362,9 +1484,12 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
update only on column:
----------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1372,6 +1497,7 @@ grant SELECT(f1),INSERT,UPDATE(f1) on priv_db.t1
to test_yesprivs@localhost;
grant SELECT(f1),INSERT,UPDATE(f1) on priv_db.t2
to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1382,6 +1508,7 @@ create trigger trg1_1 before UPDATE on t1 for each row
set new.f1 = 'trig 1_1-yes';
create trigger trg2_1 before UPDATE on t2 for each row
set new.f1 = 'trig 2_1-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1402,6 +1529,7 @@ update t2 set f1 = 'update1_no'
select f1 from t2 order by f1;
f1
trig 2_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1415,12 +1543,14 @@ GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C4973
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT (f1), INSERT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT (f1), INSERT, UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
insert into t1 (f1) values ('insert2-yes');
insert into t2 (f1) values ('insert2-yes');
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1446,6 +1576,7 @@ trig 2_1-yes
check if access only on one of three columns
--------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1453,6 +1584,7 @@ alter table priv_db.t1 add f2 char(20), add f3 int;
revoke TRIGGER on priv_db.* from test_yesprivs@localhost;
grant TRIGGER,SELECT on priv_db.t1 to test_yesprivs@localhost;
grant UPDATE on priv_db.t2 to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1465,6 +1597,7 @@ insert2-yes insert2-yes 1
insert3-yes insert3-yes 2
trig 1_1-yes NULL NULL
trig 1_1-yes NULL NULL
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1479,11 +1612,13 @@ trig 1_1-yes NULL NULL
trig 1_1-yes NULL NULL
trig 1_1-yes update4-yes 10
trig 1_1-yes update4-yes 20
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
create trigger trg1_2 after UPDATE on t1 for each row
set @f2 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1522,10 +1657,12 @@ trig 2_1-yes
check if rejected without trigger privilege:
--------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
revoke TRIGGER on priv_db.t1 from test_yesprivs@localhost;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1545,6 +1682,7 @@ trig 1_2-yes
check trigger, but not update privilege on column:
--------------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1556,6 +1694,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2), TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1563,6 +1702,7 @@ use priv_db;
drop trigger trg1_1;
create trigger trg1_3 before UPDATE on t1 for each row
set new.f1 = 'trig 1_3-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1585,6 +1725,7 @@ NULL
NULL
10
20
+connection default;
select current_user;
current_user
root@localhost
@@ -1596,6 +1737,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2, f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1613,6 +1755,9 @@ NULL
------------------------------------------------
grant TRIGGER(f1) on priv_db.t1 to test_yesprivs@localhost;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(f1) on priv_db.t1 to test_yesprivs@localhost' at line 1
+disconnect yes_privs;
+disconnect no_privs;
+connection default;
select current_user;
current_user
root@localhost
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
index c51347d5fa8..d450096176d 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
@@ -69,13 +69,18 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
+connect con1_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect con1_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.4:
---------------
+connection default;
use test;
Testcase 3.5.4.1:
-----------------
+connection con1_super;
create database db_drop;
Use db_drop;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
@@ -83,28 +88,33 @@ grant INSERT, SELECT on db_drop.t1 to test_general;
Use db_drop;
Create trigger trg1 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.1';
+connection con1_general;
Use db_drop;
Insert into t1 values ('Insert error 3.5.4.1');
Select * from t1 order by f1;
f1
Trigger 3.5.4.1
+connection con1_super;
drop trigger trg1;
select trigger_schema, trigger_name, event_object_table
from information_schema.triggers
where trigger_schema = 'db_drop'
order by trigger_name;
trigger_schema trigger_name event_object_table
+connection con1_general;
Insert into t1 values ('Insert no trigger 3.5.4.1');
Select * from t1 order by f1;
f1
Insert no trigger 3.5.4.1
Trigger 3.5.4.1
+connection con1_super;
drop trigger trg1;
drop database if exists db_drop;
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.4.2:
-----------------
+connection con1_super;
create database db_drop2;
Use db_drop2;
drop table if exists t1_432 ;
@@ -116,6 +126,7 @@ drop database if exists db_drop2;
Testcase 3.5.4.3:
-----------------
+connection con1_super;
create database db_drop3;
Use db_drop3;
drop table if exists t1_433 ;
@@ -139,17 +150,20 @@ drop database if exists db_drop3;
Testcase 3.5.4.4:
-----------------
+connection con1_super;
create database db_drop4;
Use db_drop4;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop4.t1 to test_general;
Create trigger trg4 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.4';
+connection con1_general;
Use db_drop4;
Insert into t1 values ('Insert 3.5.4.4');
Select * from t1;
f1
Trigger 3.5.4.4
+connection con1_super;
Drop database db_drop4;
Show databases like 'db_drop4';
Database (db_drop4)
@@ -161,10 +175,12 @@ create database db_drop4;
Use db_drop4;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop4.t1 to test_general;
+connection con1_general;
Insert into t1 values ('2nd Insert 3.5.4.4');
Select * from t1;
f1
2nd Insert 3.5.4.4
+connection con1_super;
drop trigger trg4;
ERROR HY000: Trigger does not exist
drop database if exists db_drop4;
@@ -172,17 +188,20 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.4.5:
-----------------
+connection con1_super;
create database db_drop5;
Use db_drop5;
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
grant INSERT, SELECT on t1 to test_general;
Create trigger trg5 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.5';
+connection con1_general;
Use db_drop5;
Insert into t1 values ('Insert 3.5.4.5');
Select * from t1;
f1
Trigger 3.5.4.5
+connection con1_super;
Drop table t1;
Show tables;
Tables_in_db_drop5
@@ -192,10 +211,12 @@ where information_schema.triggers.trigger_name='trg5';
trigger_schema trigger_name event_object_table
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
grant INSERT, SELECT on t1 to test_general;
+connection con1_general;
Insert into t1 values ('2nd Insert 3.5.4.5');
Select * from t1;
f1
2nd Insert 3.5.4.5
+connection con1_super;
drop trigger trg5;
ERROR HY000: Trigger does not exist
drop database if exists db_drop5;
@@ -203,6 +224,7 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.5:
---------------
+connection default;
use test;
Testcase 3.5.5.1:
@@ -228,6 +250,7 @@ drop view vw3;
Testcase 3.5.5.4:
-----------------
+connection con1_super;
create database dbtest_one;
create database dbtest_two;
use dbtest_two;
@@ -238,6 +261,7 @@ on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4';
ERROR HY000: Trigger in wrong schema
grant INSERT, SELECT on dbtest_two.t2 to test_general;
grant SELECT on dbtest_one.* to test_general;
+connection con1_general;
use dbtest_two;
Insert into t2 values ('1st Insert 3.5.5.4');
Warnings:
@@ -253,12 +277,14 @@ Select * from dbtest_two.t2 order by f1;
f1
1st Insert 3.5.
2nd Insert 3.5.
+connection con1_super;
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
DROP DATABASE if exists dbtest_one;
drop database if EXISTS dbtest_two;
Testcase 3.5.6:
---------------
+connection default;
use test;
Testcase 3.5.6.1 (see Testcase 3.5.1.1)
@@ -466,6 +492,7 @@ delete from tb3 where f121='Test 3.5.7.15/16';
Testcase 3.5.7.17 (see Testcase 3.5.1.1)
----------------------------------------
+connection default;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_08.result b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
index 20354088a0f..a45a31c31bd 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_08.result
@@ -69,6 +69,9 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
+connect con2_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect con2_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.8.1: (implied in previous tests)
---------------------------------------------
@@ -78,6 +81,7 @@ Testcase 3.5.8.2: (implied in previous tests)
Testcase 3.5.8.3/4:
-------------------
+connection con2_super;
create database db_test;
grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general;
grant LOCK TABLES on db_test.* to test_general;
@@ -124,6 +128,7 @@ delete from db_test.t1_d where d136= new.f136;
select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u
where u136= new.f136;
END//
+connection con2_general;
Use test;
set @test_var=0;
Insert into tb3 (f120, f122, f136, f144, f163)
@@ -153,11 +158,13 @@ select @test_var;
3.5.8.4 - single SQL - insert
-----------------------------
+connection con2_super;
Create trigger trg2 BEFORE UPDATE on tb3 for each row
BEGIN
insert into db_test.t1_i
values (new.f120, new.f136, new.f144, new.f163);
END//
+connection con2_general;
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
f120 f122 f136 f144 f163
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
@@ -176,11 +183,13 @@ I 00222 0000023456 1.050000000000000000000000000000
3.5.8.4 - single SQL - update
-----------------------------
+connection con2_super;
drop trigger trg2;
Create trigger trg3 BEFORE UPDATE on tb3 for each row
update db_test.t1_u
set u120=new.f120
where u136=new.f136;
+connection con2_general;
update tb3 set f120='U', f122='Test 3.5.8.4-Single Update'
where f122='Test 3.5.8.4-Single Insert';
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
@@ -197,9 +206,11 @@ U 00222 0000023456 1.050000000000000000000000000000
3.5.8.3/4 - single SQL - delete
-------------------------------
+connection con2_super;
drop trigger trg3;
Create trigger trg4 AFTER UPDATE on tb3 for each row
delete from db_test.t1_d where d136= new.f136;
+connection con2_general;
update tb3 set f120='D', f136=444,
f122='Test 3.5.8.4-Single Delete'
where f122='Test 3.5.8.4-Single Update';
@@ -213,10 +224,12 @@ c 00333 0000099999 999.990000000000000000000000000000
3.5.8.3/4 - single SQL - select
-------------------------------
+connection con2_super;
drop trigger trg4;
Create trigger trg5 AFTER UPDATE on tb3 for each row
select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u
where u136= new.f136;
+connection con2_general;
set @test_var=0;
update tb3 set f120='S', f136=111,
f122='Test 3.5.8.4-Single Select'
@@ -227,6 +240,7 @@ S Test 3.5.8.4-Single Select 00111 0000023456 1.050000000000000000000000000000
select @test_var;
@test_var
999.990000000000000000000000000000
+connection default;
drop trigger trg1;
drop trigger trg5;
drop database if exists db_test;
@@ -519,6 +533,7 @@ Set @var2=old.f120;
Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+connection default;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
diff --git a/mysql-test/suite/funcs_1/r/is_basics_mixed.result b/mysql-test/suite/funcs_1/r/is_basics_mixed.result
index 3ac17803688..2d14ada4f89 100644
--- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result
+++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result
@@ -4,7 +4,7 @@ information_schema
#######################################################################
# Testcase 3.2.1.20: USE INFORMATION_SCHEMA is supported
#######################################################################
-# Switch to connection default
+connection default;
USE test;
SELECT DATABASE();
DATABASE()
@@ -15,7 +15,7 @@ DATABASE()
information_schema
DROP USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , test;
SELECT DATABASE();
DATABASE()
test
@@ -23,7 +23,8 @@ USE information_schema;
SELECT DATABASE();
DATABASE()
information_schema
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER 'testuser1'@'localhost';
#######################################################################
# Testcase TBD1: The INFORMATION_SCHEMA cannot be dropped.
@@ -38,7 +39,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
##################################################################################
# Testcase 3.2.1.6+3.2.1.7: No user may create an INFORMATION_SCHEMA table or view
##################################################################################
-# Switch to connection default (user=root)
+connection default;
USE information_schema;
CREATE TABLE schemata ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
@@ -128,7 +129,7 @@ GRANT ALL ON *.* TO testuser1@localhost;
SHOW GRANTS FOR testuser1@localhost;
Grants for testuser1@localhost
GRANT ALL PRIVILEGES ON *.* TO 'testuser1'@'localhost'
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , test;
USE information_schema;
CREATE TABLE schemata ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
@@ -212,7 +213,8 @@ SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.v1 AS SELECT 'garbage';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
-# Switch to connection default (user=root) and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER 'testuser1'@'localhost';
###############################################################################
# Testcase 3.2.1.1+3.2.1.2: INFORMATION_SCHEMA tables can be queried via SELECT
@@ -324,7 +326,7 @@ GRANT SELECT on information_schema.* TO testuser1@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT CREATE VIEW ON information_schema.* TO 'u_6_401018'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT table_schema,table_name FROM information_schema.tables
WHERE table_schema = 'information_schema' AND table_name = 'tables';
table_schema table_name
@@ -349,7 +351,7 @@ TABLE_SCHEMA TABLE_NAME TABLE_TYPE
db_datadict t1 BASE TABLE
db_datadict v2 VIEW
GRANT SELECT ON db_datadict.v2 to testuser2@localhost;
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict;
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM db_datadict.v2;
TABLE_SCHEMA TABLE_NAME TABLE_TYPE
@@ -358,7 +360,9 @@ SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM information_schema.tables WHERE table_schema = 'db_datadict';
TABLE_SCHEMA TABLE_NAME TABLE_TYPE
db_datadict v2 VIEW
-# Switch to connection default and close connections testuser1 and testuser2
+connection default;
+disconnect testuser1;
+disconnect testuser2;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP DATABASE db_datadict;
@@ -533,7 +537,7 @@ db_datadict
DROP USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
GRANT ALL ON test.* TO 'testuser1'@'localhost';
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , test;
SELECT DISTINCT table_schema FROM information_schema.columns
WHERE table_schema LIKE 'db_data%';
table_schema
@@ -573,7 +577,8 @@ trigger_schema event_object_schema
SELECT DISTINCT table_schema FROM information_schema.views
WHERE table_schema LIKE 'db_data%';
table_schema
-# Switch to connection default and close connections testuser1 and testuser2
+connection default;
+disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
########################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_column_privileges.result b/mysql-test/suite/funcs_1/r/is_column_privileges.result
index a57970dbcaa..a56ef002935 100644
--- a/mysql-test/suite/funcs_1/r/is_column_privileges.result
+++ b/mysql-test/suite/funcs_1/r/is_column_privileges.result
@@ -105,7 +105,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRAN
'testuser1'@'localhost' def db_datadict t1 f3 UPDATE YES
'testuser2'@'localhost' def db_datadict t1 f2 SELECT NO
'testuser3'@'localhost' def db_datadict t1 f3 SELECT YES
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.column_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
@@ -115,13 +115,13 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRAN
'testuser1'@'localhost' def db_datadict t1 f2 UPDATE YES
'testuser1'@'localhost' def db_datadict t1 f3 SELECT YES
'testuser1'@'localhost' def db_datadict t1 f3 UPDATE YES
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.column_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'testuser2'@'localhost' def db_datadict t1 f2 SELECT NO
-# Establish connection testuser3 (user=testuser3)
+connect testuser3, localhost, testuser3, , db_datadict;
# FIXME: Is it correct that granted TABLES do not occur in COLUMN_PRIVILEGES?
SELECT * FROM information_schema.table_privileges
WHERE grantee LIKE '''testuser%'''
@@ -163,7 +163,7 @@ WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
'testuser3'@'localhost' def db_datadict t1 f3 SELECT YES
-# Switch to connection testuser2 (user=testuser2)
+connection testuser2;
SELECT * FROM information_schema.column_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
@@ -171,7 +171,10 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRAN
'testuser2'@'localhost' def db_datadict t1 f1 SELECT NO
'testuser2'@'localhost' def db_datadict t1 f2 SELECT NO
'testuser2'@'localhost' def db_datadict t1 f3 SELECT NO
-# Switch to connection default and close connections testuser1,testuser2,testuser3
+connection default;
+disconnect testuser1;
+disconnect testuser2;
+disconnect testuser3;
DROP DATABASE db_datadict;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
@@ -194,7 +197,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , test;
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
@@ -203,7 +206,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
-# Switch to connection default
+connection default;
GRANT SELECT (f1,f3) ON db_datadict.my_table TO 'testuser1'@'localhost';
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
@@ -216,7 +219,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
GRANT SELECT (f3, f1) ON `db_datadict`.`my_table` TO 'testuser1'@'localhost'
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
@@ -228,7 +231,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
GRANT SELECT (f3, f1) ON `db_datadict`.`my_table` TO 'testuser1'@'localhost'
-# Switch to connection default
+connection default;
ALTER TABLE db_datadict.my_table DROP COLUMN f3;
GRANT UPDATE (f1) ON db_datadict.my_table TO 'testuser1'@'localhost';
SELECT * FROM information_schema.column_privileges
@@ -243,7 +246,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO 'testuser1'@'localhost'
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
@@ -258,7 +261,7 @@ GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO 'testuser1'@'localhost'
SELECT f1, f3 FROM db_datadict.my_table;
ERROR 42S22: Unknown column 'f3' in 'field list'
-# Switch to connection default
+connection default;
ALTER TABLE db_datadict.my_table CHANGE COLUMN f1 my_col BIGINT;
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
@@ -272,7 +275,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO 'testuser1'@'localhost'
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
@@ -285,7 +288,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO 'testuser1'@'localhost'
-# Switch to connection default
+connection default;
DROP TABLE db_datadict.my_table;
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
@@ -299,7 +302,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO 'testuser1'@'localhost'
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
@@ -312,7 +315,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
GRANT SELECT (f3, f1), UPDATE (f1) ON `db_datadict`.`my_table` TO 'testuser1'@'localhost'
-# Switch to connection default
+connection default;
REVOKE ALL ON db_datadict.my_table FROM 'testuser1'@'localhost';
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
@@ -322,7 +325,7 @@ SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.column_privileges
WHERE table_name = 'my_table'
ORDER BY grantee, table_schema,table_name,column_name,privilege_type;
@@ -331,7 +334,8 @@ SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT ALL PRIVILEGES ON `test`.* TO 'testuser1'@'localhost'
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
########################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result b/mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result
index acf26587004..1492bd26b5d 100644
--- a/mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result
+++ b/mysql-test/suite/funcs_1/r/is_column_privileges_is_mysql_test.result
@@ -19,7 +19,7 @@ mysql
SHOW DATABASES LIKE 'test';
Database (test)
test
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.column_privileges
WHERE table_schema IN ('information_schema','mysql','test')
ORDER BY table_schema, table_name, column_name;
@@ -32,6 +32,6 @@ Database (mysql)
SHOW DATABASES LIKE 'test';
Database (test)
test
-# Switch to connection default and close connection testuser1
+connection default;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_columns.result b/mysql-test/suite/funcs_1/r/is_columns.result
index ada8110d229..ff833b092d1 100644
--- a/mysql-test/suite/funcs_1/r/is_columns.result
+++ b/mysql-test/suite/funcs_1/r/is_columns.result
@@ -147,7 +147,7 @@ SHOW COLUMNS FROM db_datadict.v1;
Field Type Null Key Default Extra
f1 int(1) NO 0
f2 int(1) NO 0
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.columns
WHERE table_schema = 'db_datadict'
ORDER BY table_schema, table_name, ordinal_position;
@@ -164,7 +164,7 @@ ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 't2
SHOW COLUMNS FROM db_datadict.v1;
Field Type Null Key Default Extra
f2 int(1) NO 0
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.columns
WHERE table_schema = 'db_datadict'
ORDER BY table_schema, table_name, ordinal_position;
@@ -179,7 +179,9 @@ f1 char(10) NO PRI NULL
f2 text YES NULL
SHOW COLUMNS FROM db_datadict.v1;
ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 'v1'
-# Switch to connection default and close connections testuser1, testuser2
+connection default;
+disconnect testuser1;
+disconnect testuser2;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP DATABASE IF EXISTS db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage.result b/mysql-test/suite/funcs_1/r/is_key_column_usage.result
index e27b4d06d25..79310904d0f 100644
--- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result
+++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result
@@ -170,21 +170,23 @@ table_catalog, table_schema, table_name, ordinal_position;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
def db_datadict PRIMARY def db_datadict t1_1 f1 1 NULL NULL NULL NULL
def db_datadict PRIMARY def db_datadict t1_2 f1 1 NULL NULL NULL NULL
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.key_column_usage
WHERE table_name LIKE 't1_%'
ORDER BY constraint_catalog, constraint_schema, constraint_name,
table_catalog, table_schema, table_name, ordinal_position;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
def db_datadict PRIMARY def db_datadict t1_1 f1 1 NULL NULL NULL NULL
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.key_column_usage
WHERE table_name LIKE 't1_%'
ORDER BY constraint_catalog, constraint_schema, constraint_name,
table_catalog, table_schema, table_name, ordinal_position;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
def db_datadict PRIMARY def db_datadict t1_2 f1 1 NULL NULL NULL NULL
-# Switch to connection default and close connections testuser1, testuser2
+connection default;
+disconnect testuser1;
+disconnect testuser2;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP TABLE t1_1;
diff --git a/mysql-test/suite/funcs_1/r/is_routines.result b/mysql-test/suite/funcs_1/r/is_routines.result
index 525b5c92a68..0afb6a3a7ae 100644
--- a/mysql-test/suite/funcs_1/r/is_routines.result
+++ b/mysql-test/suite/funcs_1/r/is_routines.result
@@ -187,19 +187,22 @@ GRANT EXECUTE ON PROCEDURE db_datadict_2.sp_6_408002_2
TO 'testuser2'@'localhost';
GRANT EXECUTE ON db_datadict_2.* TO 'testuser2'@'localhost';
FLUSH PRIVILEGES;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.routines;
SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
sp_6_408002_1 def db_datadict sp_6_408002_1 PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL NULL NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL NULL NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.routines;
SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL NULL NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-# Establish connection testuser3 (user=testuser3)
+connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.routines;
SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
-# Switch to connection default and close connections testuser1,testuser2,testuser3
+connection default;
+disconnect testuser1;
+disconnect testuser2;
+disconnect testuser3;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP USER 'testuser3'@'localhost';
diff --git a/mysql-test/suite/funcs_1/r/is_schema_privileges.result b/mysql-test/suite/funcs_1/r/is_schema_privileges.result
index 9d4b2a537d6..cf9b70308de 100644
--- a/mysql-test/suite/funcs_1/r/is_schema_privileges.result
+++ b/mysql-test/suite/funcs_1/r/is_schema_privileges.result
@@ -104,7 +104,7 @@ GRANT INSERT ON db_datadict_2.t1 TO 'testuser1'@'localhost';
GRANT SELECT ON db_datadict_4.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
GRANT SELECT ON db_datadict_3.* TO 'testuser2'@'localhost';
GRANT SELECT ON db_datadict_1.* TO 'testuser2'@'localhost';
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , test;
GRANT SELECT ON db_datadict_4.* TO 'testuser2'@'localhost';
# Root granted INSERT db_datadict_1 to me -> visible
# Root granted SELECT db_datadict_1 to testuser2 -> invisible
@@ -128,7 +128,7 @@ GRANT SELECT ON `db_datadict_4`.* TO 'testuser1'@'localhost' WITH GRANT OPTION
GRANT INSERT ON `db_datadict_2`.`t1` TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , test;
# Root granted SELECT db_datadict_1 to me -> visible
# Root granted INSERT db_datadict_1 to testuser1 -> invisible
# Root granted INSERT db_datadict_2.t1 but not db_datadict_1 to testuser1 -> invisible
@@ -149,7 +149,9 @@ GRANT USAGE ON *.* TO 'testuser2'@'localhost'
GRANT SELECT ON `db_datadict_3`.* TO 'testuser2'@'localhost'
GRANT SELECT ON `db_datadict_1`.* TO 'testuser2'@'localhost'
GRANT SELECT ON `db_datadict_4`.* TO 'testuser2'@'localhost'
-# Switch to connection default and close connections testuser1 and testuser2
+connection default;
+disconnect testuser1;
+disconnect testuser2;
SELECT * FROM information_schema.schema_privileges
WHERE table_schema LIKE 'db_datadict%'
ORDER BY grantee,table_schema,privilege_type;
@@ -189,25 +191,24 @@ SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , test;
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
-# Switch to connection default
+connection default;
GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost';
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict UPDATE NO
-# Switch to connection testuser1
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict UPDATE NO
-# Switch to connection default
+connection default;
GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost';
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
@@ -215,7 +216,6 @@ ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict SELECT NO
'testuser1'@'localhost' def db_datadict UPDATE NO
-# Switch to connection testuser1
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
@@ -223,6 +223,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict SELECT NO
'testuser1'@'localhost' def db_datadict UPDATE NO
# Switch to connection default
+connection default;
GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
@@ -230,14 +231,13 @@ ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict SELECT YES
'testuser1'@'localhost' def db_datadict UPDATE YES
-# Switch to connection testuser1
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict SELECT YES
'testuser1'@'localhost' def db_datadict UPDATE YES
-# Switch to connection default
+connection default;
DROP SCHEMA db_datadict;
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
@@ -245,48 +245,45 @@ ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict SELECT YES
'testuser1'@'localhost' def db_datadict UPDATE YES
-# Switch to connection testuser1
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict SELECT YES
'testuser1'@'localhost' def db_datadict UPDATE YES
-# Switch to connection default
+connection default;
REVOKE UPDATE ON db_datadict.* FROM 'testuser1'@'localhost';
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict SELECT YES
-# Switch to connection testuser1
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'testuser1'@'localhost' def db_datadict SELECT YES
-# Switch to connection default
+connection default;
RENAME USER 'testuser1'@'localhost' TO 'the_user'@'localhost';
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'the_user'@'localhost' def db_datadict SELECT YES
-# Switch to connection testuser1
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'the_user'@'localhost' def db_datadict SELECT YES
-# Close connection testuser1
-# Establish connection the_user (user=the_user)
+disconnect testuser1;
+connect the_user, localhost, the_user, , test;
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
'the_user'@'localhost' def db_datadict SELECT YES
-# Close connection the_user
-# Switch to connection default
+disconnect the_user;
+connection default;
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'db_datadict'
ORDER BY grantee,table_schema,privilege_type;
diff --git a/mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result b/mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result
index a55d3ea8e4d..38257899a4b 100644
--- a/mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result
+++ b/mysql-test/suite/funcs_1/r/is_schema_privileges_is_mysql_test.result
@@ -35,7 +35,7 @@ mysql
SHOW DATABASES LIKE 'test';
Database (test)
test
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.schema_privileges
WHERE table_schema IN ('information_schema','mysql','test')
ORDER BY grantee, table_schema, privilege_type;
@@ -48,6 +48,6 @@ Database (mysql)
SHOW DATABASES LIKE 'test';
Database (test)
test
-# Switch to connection default and close connection testuser1
+connection default;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_schemata.result b/mysql-test/suite/funcs_1/r/is_schemata.result
index 92e01814b0e..d0f2b734f7e 100644
--- a/mysql-test/suite/funcs_1/r/is_schemata.result
+++ b/mysql-test/suite/funcs_1/r/is_schemata.result
@@ -83,7 +83,7 @@ SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
db_datadict_2
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict_1;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
@@ -91,7 +91,7 @@ def db_datadict_1 latin1 latin1_swedish_ci NULL
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict_2;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
@@ -101,13 +101,16 @@ SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
db_datadict_1
db_datadict_2
-# Establish connection testuser3 (user=testuser3)
+connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.schemata
WHERE schema_name LIKE 'db_datadict_%' ORDER BY schema_name;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
SHOW DATABASES LIKE 'db_datadict_%';
Database (db_datadict_%)
-# Switch to connection default and close connections testuser1,testuser2,testuser3
+connection default;
+disconnect testuser1;
+disconnect testuser2;
+disconnect testuser3;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP USER 'testuser3'@'localhost';
diff --git a/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result b/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result
index b4c8e465c71..0679142bd82 100644
--- a/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result
+++ b/mysql-test/suite/funcs_1/r/is_schemata_is_mysql_test.result
@@ -22,7 +22,7 @@ mysql
SHOW DATABASES LIKE 'test';
Database (test)
test
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.schemata
WHERE schema_name IN ('information_schema','mysql','test')
ORDER BY schema_name;
@@ -37,6 +37,6 @@ Database (mysql)
SHOW DATABASES LIKE 'test';
Database (test)
test
-# Switch to connection default and close connection testuser1
+connection default;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result
index e800d9b63fd..f58c3e56772 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics.result
@@ -195,7 +195,7 @@ GRANT USAGE ON *.* TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , test;
SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
@@ -205,7 +205,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , test;
SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
@@ -215,7 +215,7 @@ ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql'
SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
-# Switch to connection default
+connection default;
GRANT SELECT ON db_datadict.t1 TO 'testuser1'@'localhost' WITH GRANT OPTION;
GRANT SELECT(f1,f5) ON db_datadict_2.t3 TO 'testuser1'@'localhost';
SELECT * FROM information_schema.statistics
@@ -240,7 +240,7 @@ GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
@@ -258,7 +258,7 @@ GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
SHOW GRANTS FOR 'testuser2'@'localhost';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
-# Switch to connection testuser2
+connection testuser2;
SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
@@ -268,13 +268,13 @@ ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql'
SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
-# Switch to connection default
+connection default;
REVOKE SELECT,GRANT OPTION ON db_datadict.t1 FROM 'testuser1'@'localhost';
SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.statistics
WHERE table_schema LIKE 'db_datadict%'
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
@@ -287,7 +287,9 @@ SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
-# Switch to connection default and close connections testuser1, testuser2
+connection default;
+disconnect testuser1;
+disconnect testuser2;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_statistics_is.result b/mysql-test/suite/funcs_1/r/is_statistics_is.result
index f04a5e4c515..a4fe6054d0e 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics_is.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics_is.result
@@ -7,11 +7,12 @@ SELECT * FROM information_schema.statistics
WHERE table_schema = 'information_schema'
ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.statistics
WHERE table_schema = 'information_schema'
ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
index c9e21a12663..dc3ed5f9839 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result
@@ -79,11 +79,12 @@ def mysql time_zone_transition_type 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL
def mysql time_zone_transition_type 0 mysql PRIMARY 2 Transition_type_id A #CARD# NULL NULL BTREE
def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.statistics
WHERE table_schema = 'mysql'
ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
index dbe786d39ef..cbc9a8f17ce 100644
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
@@ -79,7 +79,7 @@ def mysql time_zone_transition_type 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL
def mysql time_zone_transition_type 0 mysql PRIMARY 2 Transition_type_id A #CARD# NULL NULL BTREE
def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.statistics
WHERE table_schema = 'mysql'
ORDER BY table_schema, table_name, index_name, seq_in_index, column_name;
@@ -156,6 +156,7 @@ def mysql time_zone_transition_type 0 mysql PRIMARY 1 Time_zone_id A #CARD# NULL
def mysql time_zone_transition_type 0 mysql PRIMARY 2 Transition_type_id A #CARD# NULL NULL BTREE
def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints.result b/mysql-test/suite/funcs_1/r/is_table_constraints.result
index ea2dd5ccd98..37fcce5ae42 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result
@@ -127,7 +127,7 @@ SHOW INDEXES FROM db_datadict.t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t2 0 PRIMARY 1 f1 ### ### ### ### ### ### ###
t2 0 PRIMARY 2 f2 ### ### ### ### ### ### ###
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SHOW GRANTS FOR 'testuser1'@'localhost';
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@@ -148,7 +148,8 @@ t1 0 my_idx1 2 f1 ### ### ### ### ### ### ###
t1 0 my_idx2 1 f3 ### ### ### ### ### ### ###
SHOW INDEXES FROM db_datadict.t2;
ERROR 42000: SELECT command denied to user 'testuser1'@'localhost' for table 't2'
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
#########################################################################################
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_is.result b/mysql-test/suite/funcs_1/r/is_table_constraints_is.result
index 78724caa175..2a5fff26b88 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_is.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_is.result
@@ -7,11 +7,12 @@ SELECT * FROM information_schema.table_constraints
WHERE table_schema = 'information_schema'
ORDER BY table_schema,table_name,constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.table_constraints
WHERE table_schema = 'information_schema'
ORDER BY table_schema,table_name,constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
index 05df41570cf..e54de0671a2 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
@@ -38,11 +38,12 @@ def mysql PRIMARY mysql time_zone_name PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
def mysql PRIMARY mysql user PRIMARY KEY
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.table_constraints
WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name,constraint_name;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
index fd13d67f07c..58a2373b66d 100644
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
@@ -38,7 +38,7 @@ def mysql PRIMARY mysql time_zone_name PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
def mysql PRIMARY mysql user PRIMARY KEY
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,db_datadict;
SELECT * FROM information_schema.table_constraints
WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name,constraint_name;
@@ -74,6 +74,7 @@ def mysql PRIMARY mysql time_zone_name PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition PRIMARY KEY
def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY
def mysql PRIMARY mysql user PRIMARY KEY
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/r/is_table_privileges.result b/mysql-test/suite/funcs_1/r/is_table_privileges.result
index f7e443bbd35..153164ba2cc 100644
--- a/mysql-test/suite/funcs_1/r/is_table_privileges.result
+++ b/mysql-test/suite/funcs_1/r/is_table_privileges.result
@@ -73,7 +73,7 @@ CREATE USER 'testuser2'@'localhost';
GRANT ALL ON db_datadict.tb1 TO 'testuser2'@'localhost' WITH GRANT OPTION;
DROP USER 'testuser3'@'localhost';
CREATE USER 'testuser3'@'localhost';
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
CREATE TABLE tb3 (f1 TEXT)
ENGINE = <other_engine_type>;
GRANT SELECT ON db_datadict.tb3 TO 'testuser3'@'localhost';
@@ -87,7 +87,7 @@ Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
GRANT SELECT, CREATE ON `db_datadict`.* TO 'testuser1'@'localhost' WITH GRANT OPTION
GRANT SELECT ON `db_datadict`.`tb1` TO 'testuser1'@'localhost'
-# Establish connection testuser2 (user=testuser3)
+connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.table_privileges
WHERE table_name LIKE 'tb%'
ORDER BY grantee,table_schema,table_name,privilege_type;
@@ -108,7 +108,7 @@ SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
GRANT ALL PRIVILEGES ON `db_datadict`.`tb1` TO 'testuser2'@'localhost' WITH GRANT OPTION
-# Establish connection testuser3 (user=testuser3)
+connect testuser3, localhost, testuser3, , db_datadict;
SELECT * FROM information_schema.table_privileges
WHERE table_name LIKE 'tb%'
ORDER BY grantee,table_schema,table_name,privilege_type;
@@ -118,7 +118,10 @@ SHOW GRANTS FOR 'testuser3'@'localhost';
Grants for testuser3@localhost
GRANT USAGE ON *.* TO 'testuser3'@'localhost'
GRANT SELECT ON `db_datadict`.`tb3` TO 'testuser3'@'localhost'
-# Switch to connection default and close the other connections
+connection default;
+disconnect testuser1;
+disconnect testuser2;
+disconnect testuser3;
SELECT * FROM information_schema.table_privileges
WHERE table_name LIKE 'tb%'
ORDER BY grantee,table_schema,table_name,privilege_type;
diff --git a/mysql-test/suite/funcs_1/r/is_tables.result b/mysql-test/suite/funcs_1/r/is_tables.result
index 53fb95680e9..5ccbdd3d90c 100644
--- a/mysql-test/suite/funcs_1/r/is_tables.result
+++ b/mysql-test/suite/funcs_1/r/is_tables.result
@@ -117,7 +117,7 @@ CREATE TABLE db_datadict.tb1 (f1 INT, f2 INT, f3 INT)
ENGINE = <engine_type>;
GRANT SELECT ON db_datadict.tb1 TO 'testuser1'@'localhost';
GRANT ALL ON db_datadict.tb1 TO 'testuser2'@'localhost' WITH GRANT OPTION;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
CREATE TABLE tb2 (f1 DECIMAL)
ENGINE = <engine_type>;
CREATE TABLE tb3 (f1 VARCHAR(200))
@@ -139,7 +139,7 @@ tb1
tb2
tb3
v3
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
@@ -149,7 +149,7 @@ SHOW TABLES FROM db_datadict;
Tables_in_db_datadict
tb1
tb3
-# Establish connection testuser3 (user=testuser3)
+connect testuser3, localhost, testuser3, , db_datadict;
SELECT * FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
@@ -159,7 +159,7 @@ SHOW TABLES FROM db_datadict;
Tables_in_db_datadict
tb3
v3
-# Switch to connection default (user=root)
+connection default;
SELECT * FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
@@ -173,7 +173,9 @@ tb1
tb2
tb3
v3
-# Close connection testuser1, testuser2, testuser3
+disconnect testuser1;
+disconnect testuser2;
+disconnect testuser3;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP USER 'testuser3'@'localhost';
diff --git a/mysql-test/suite/funcs_1/r/is_tables_innodb.result b/mysql-test/suite/funcs_1/r/is_tables_innodb.result
index 204ee893fd8..23e6ad77309 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_innodb.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_innodb.result
@@ -94,7 +94,7 @@ t1
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0,
@@ -157,7 +157,8 @@ t1
t2
SHOW TABLES FROM test2;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2'
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
DROP DATABASE test2;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_is.result b/mysql-test/suite/funcs_1/r/is_tables_is.result
index daa3ce83ba2..a0f2424c07c 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_is.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_is.result
@@ -935,7 +935,7 @@ Separator -----------------------------------------------------
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0,
@@ -1868,6 +1868,7 @@ CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
index daa3ce83ba2..a0f2424c07c 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
@@ -935,7 +935,7 @@ Separator -----------------------------------------------------
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0,
@@ -1868,6 +1868,7 @@ CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_memory.result b/mysql-test/suite/funcs_1/r/is_tables_memory.result
index acf6636cd38..2ee21898085 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_memory.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_memory.result
@@ -95,7 +95,7 @@ t1
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0,
@@ -158,7 +158,8 @@ t1
t2
SHOW TABLES FROM test2;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2'
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
DROP DATABASE test2;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_myisam.result b/mysql-test/suite/funcs_1/r/is_tables_myisam.result
index 5ef3fbaafab..5ccd8377cb1 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_myisam.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_myisam.result
@@ -95,7 +95,7 @@ t1
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0,
@@ -158,7 +158,8 @@ t1
t2
SHOW TABLES FROM test2;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'test2'
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
DROP DATABASE test2;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result
index 3ffa2662313..5a1b6df84cb 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_myisam_embedded.result
@@ -95,7 +95,7 @@ t1
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0,
@@ -182,7 +182,8 @@ t2
SHOW TABLES FROM test2;
Tables_in_test2
t1
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
DROP DATABASE test2;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result
index 430c7fe2580..c9c86b4e96e 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result
@@ -703,7 +703,7 @@ Separator -----------------------------------------------------
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0,
@@ -714,6 +714,7 @@ AS "user_comment",
FROM information_schema.tables
WHERE table_schema = 'mysql'
ORDER BY table_schema,table_name;
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
index f1a6cc327b7..479312334a7 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
@@ -703,7 +703,7 @@ Separator -----------------------------------------------------
DROP USER testuser1@localhost;
CREATE USER testuser1@localhost;
GRANT SELECT ON test1.* TO testuser1@localhost;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1,localhost,testuser1,,test1;
SELECT *,
LEFT( table_comment,
IF(INSTR(table_comment,'InnoDB free') = 0,
@@ -1404,6 +1404,7 @@ CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment Users and global privileges
Separator -----------------------------------------------------
-# Switch to connection default and close connection testuser1
+connection default;
+disconnect testuser1;
DROP USER testuser1@localhost;
DROP DATABASE test1;
diff --git a/mysql-test/suite/funcs_1/r/is_triggers.result b/mysql-test/suite/funcs_1/r/is_triggers.result
index d6b5f3a42bf..e64086431e3 100644
--- a/mysql-test/suite/funcs_1/r/is_triggers.result
+++ b/mysql-test/suite/funcs_1/r/is_triggers.result
@@ -125,7 +125,7 @@ GRANT TRIGGER ON *.* TO 'testuser1'@'localhost';
GRANT TRIGGER ON *.* TO 'testuser3'@'localhost';
GRANT TRIGGER ON *.* TO 'testuser4'@'localhost';
GRANT ALL ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
CREATE TABLE db_datadict.t1 (f1 INT, f2 INT, f3 INT)
ENGINE = <engine_type>;
CREATE TRIGGER trg1 BEFORE INSERT
@@ -140,7 +140,7 @@ def db_datadict trg1 INSERT def db_datadict t1 0 NULL SET @test_before = 2, new.
SHOW TRIGGERS FROM db_datadict;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict;
SHOW GRANTS FOR 'testuser2'@'localhost';
Grants for testuser2@localhost
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
@@ -151,7 +151,7 @@ WHERE trigger_name = 'trg1';
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
SHOW TRIGGERS FROM db_datadict;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
-# Establish connection testuser3 (user=testuser3)
+connect testuser3, localhost, testuser3, , test;
SHOW GRANTS FOR 'testuser3'@'localhost';
Grants for testuser3@localhost
GRANT TRIGGER ON *.* TO 'testuser3'@'localhost'
@@ -164,7 +164,7 @@ def db_datadict trg1 INSERT def db_datadict t1 0 NULL SET @test_before = 2, new.
SHOW TRIGGERS FROM db_datadict;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-# Establish connection testuser4 (user=testuser4)
+connect testuser4, localhost, testuser4, , test;
SHOW GRANTS FOR 'testuser4'@'localhost';
Grants for testuser4@localhost
GRANT TRIGGER ON *.* TO 'testuser4'@'localhost'
@@ -180,7 +180,11 @@ def db_datadict trg1 INSERT def db_datadict t1 0 NULL SET @test_before = 2, new.
SHOW TRIGGERS FROM db_datadict;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1 INSERT t1 SET @test_before = 2, new.f1 = @test_before BEFORE NULL testuser1@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-# Switch to connection default and close connections testuser1 - testuser4
+connection default;
+disconnect testuser1;
+disconnect testuser2;
+disconnect testuser3;
+disconnect testuser4;
SELECT * FROM information_schema.triggers
WHERE trigger_name = 'trg1';
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
diff --git a/mysql-test/suite/funcs_1/r/is_user_privileges.result b/mysql-test/suite/funcs_1/r/is_user_privileges.result
index dfbe50ad862..a300a1f73e7 100644
--- a/mysql-test/suite/funcs_1/r/is_user_privileges.result
+++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result
@@ -387,7 +387,7 @@ password_expired N
is_role N
default_role
max_statement_time 0.000000
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , db_datadict;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
@@ -542,7 +542,7 @@ GRANT SELECT, UPDATE ON `db_datadict`.* TO 'testuser1'@'localhost' WITH GRANT OP
GRANT SELECT ON `mysql`.`user` TO 'testuser1'@'localhost'
# Now add SELECT on *.* to testuser1;
-# Switch to connection default
+connection default;
GRANT SELECT ON *.* TO 'testuser1'@'localhost';
#
# Here <SELECT NO> is shown correctly for testuser1;
@@ -867,7 +867,7 @@ password_expired N
is_role N
default_role
max_statement_time 0.000000
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
@@ -1020,7 +1020,7 @@ Grants for testuser1@localhost
GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION
GRANT SELECT, UPDATE ON `db_datadict`.* TO 'testuser1'@'localhost' WITH GRANT OPTION
GRANT SELECT ON `mysql`.`user` TO 'testuser1'@'localhost'
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
@@ -1038,7 +1038,7 @@ ERROR 42000: SELECT command denied to user 'testuser2'@'localhost' for table 'us
SHOW GRANTS;
Grants for testuser2@localhost
GRANT INSERT, UPDATE ON *.* TO 'testuser2'@'localhost'
-# Establish connection testuser3 (user=testuser3)
+connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
@@ -1054,7 +1054,7 @@ Grants for testuser3@localhost
GRANT USAGE ON *.* TO 'testuser3'@'localhost'
# Revoke privileges from testuser1;
-# Switch to connection default
+connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'testuser1'@'localhost';
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@@ -1215,7 +1215,7 @@ password_expired N
is_role N
default_role
max_statement_time 0.000000
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
@@ -1248,7 +1248,7 @@ CREATE TABLE db_datadict.tb_66 ( c1 TEXT );
ERROR 42000: CREATE command denied to user 'testuser1'@'localhost' for table 'tb_66'
# Add ALL on db_datadict.* (and select on mysql.user) to testuser1;
-# Switch to connection default
+connection default;
GRANT ALL ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
GRANT SELECT ON mysql.user TO 'testuser1'@'localhost';
SELECT * FROM information_schema.user_privileges
@@ -1410,7 +1410,7 @@ password_expired N
is_role N
default_role
max_statement_time 0.000000
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
@@ -1722,7 +1722,7 @@ CREATE TABLE tb_57 ( c1 TEXT )
ENGINE = <other_engine_type>;
# Revoke privileges from testuser1;
-# Switch to connection default
+connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'testuser1'@'localhost';
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@@ -1883,7 +1883,7 @@ password_expired N
is_role N
default_role
max_statement_time 0.000000
-# Switch to connection testuser1
+connection testuser1;
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
ORDER BY grantee, table_catalog, privilege_type;
@@ -1903,7 +1903,10 @@ USE db_datadict;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'db_datadict'
CREATE TABLE db_datadict.tb_59 ( c1 TEXT )
ENGINE = <other_engine_type>;
-# Switch to connection default and close connections testuser1,testuser2,testuser3
+connection default;
+disconnect testuser1;
+disconnect testuser2;
+disconnect testuser3;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP USER 'testuser3'@'localhost';
diff --git a/mysql-test/suite/funcs_1/r/is_views.result b/mysql-test/suite/funcs_1/r/is_views.result
index 12a46aeacce..6c22fed6379 100644
--- a/mysql-test/suite/funcs_1/r/is_views.result
+++ b/mysql-test/suite/funcs_1/r/is_views.result
@@ -93,22 +93,25 @@ WHERE table_schema = 'db_datadict' ORDER BY table_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM
def db_datadict v_granted_glob select `db_datadict`.`t1`.`f2` AS `f2`,`db_datadict`.`t1`.`f3` AS `f3` from `db_datadict`.`t1` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
def db_datadict v_granted_to_1 select `db_datadict`.`t1`.`f1` AS `f1`,`db_datadict`.`t1`.`f2` AS `f2`,`db_datadict`.`t1`.`f3` AS `f3` from `db_datadict`.`t1` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
-# Establish connection testuser1 (user=testuser1)
+connect testuser1, localhost, testuser1, , test;
SELECT * FROM information_schema.views
WHERE table_schema = 'db_datadict' ORDER BY table_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM
def db_datadict v_granted_to_1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
-# Establish connection testuser2 (user=testuser2)
+connect testuser2, localhost, testuser2, , test;
SELECT * FROM information_schema.views
WHERE table_schema = 'db_datadict' ORDER BY table_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM
def db_datadict v_granted_glob NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
def db_datadict v_granted_to_1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED
-# Establish connection test_no_views (user=test_no_views)
+connect test_no_views, localhost, test_no_views, , test;
SELECT * FROM information_schema.views
WHERE table_schema = 'db_datadict' ORDER BY table_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM
-# Switch to connection default and close all other connections
+connection default;
+disconnect testuser1;
+disconnect testuser2;
+disconnect test_no_views;
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP USER 'test_no_views'@'localhost';
diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
index c38481bac50..a0a48842ef8 100644
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result
@@ -66,6 +66,7 @@ load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t11;
Section 3.1.6 - Privilege Checks:
--------------------------------------------------------------------------------
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -80,6 +81,7 @@ grant all on db_storedproc_1.* to 'user_1'@'localhost';
revoke create routine on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS sp1;
+connect user1a, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -88,10 +90,13 @@ BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
ERROR 42000: Access denied for user 'user_1'@'localhost' to database 'db_storedproc_1'
+disconnect user1a;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
+connect user1b, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -99,6 +104,8 @@ CREATE PROCEDURE sp1(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
+disconnect user1b;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -114,6 +121,7 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
+connect user2, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3(v1 char(20))
@@ -124,6 +132,8 @@ CREATE FUNCTION fn1(v1 int) returns int
BEGIN
return v1;
END//
+disconnect user2;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -146,6 +156,7 @@ CREATE PROCEDURE sp4(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
+connect user3, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -167,6 +178,8 @@ SQL_DATA_ACCESS CONTAINS SQL
SECURITY_TYPE DEFINER
SQL_MODE NO_ENGINE_SUBSTITUTION
ROUTINE_COMMENT
+disconnect user3;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp4;
@@ -187,6 +200,7 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
flush privileges;
+connect user5_1, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp5_s_i () sql security definer
@@ -202,6 +216,8 @@ CREATE PROCEDURE sp5_ins () sql security definer
BEGIN
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_ins', 1000);
END//
+disconnect user5_1;
+connect user5_2, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -210,12 +226,14 @@ CALL sp5_ins();
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+connection default;
root@localhost db_storedproc_1
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
grant insert on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -223,12 +241,14 @@ ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165
CALL sp5_ins();
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+connection default;
root@localhost db_storedproc_1
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
grant SELECT on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -242,10 +262,12 @@ inserted outside of SP NULL
inserted from sp5_ins 2000-10-00
inserted from sp5_s_i 2000-10-00
inserted from sp5_ins 2000-10-00
+connection default;
root@localhost db_storedproc_1
REVOKE INSERT on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -263,10 +285,12 @@ inserted outside of SP NULL
inserted from sp5_ins 2000-10-00
inserted from sp5_s_i 2000-10-00
inserted from sp5_ins 2000-10-00
+connection default;
root@localhost db_storedproc_1
REVOKE SELECT on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -275,6 +299,8 @@ CALL sp5_ins();
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+disconnect user5_2;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp5_s_i;
@@ -299,6 +325,7 @@ GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_1, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3166_s_i () SQL SECURITY INVOKER
@@ -314,6 +341,8 @@ CREATE PROCEDURE sp3166_ins () SQL SECURITY INVOKER
BEGIN
insert into db_storedproc_1.t3166 values ('inserted from sp3166_ins');
END//
+disconnect user6_1;
+connect user6_2, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -325,6 +354,7 @@ ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166
CALL sp3166_sel();
c1
inserted outside SP
+connection default;
root@localhost db_storedproc_1
CALL sp3166_sel();
@@ -332,6 +362,8 @@ c1
inserted outside SP
GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+disconnect user6_2;
+connect user6_3, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -343,6 +375,8 @@ c1
inserted outside SP
inserted from sp3166_s_i
inserted from sp3166_ins
+disconnect user6_3;
+connection default;
root@localhost db_storedproc_1
CALL sp3166_sel();
@@ -352,6 +386,7 @@ inserted from sp3166_s_i
inserted from sp3166_ins
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_4, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -359,6 +394,8 @@ ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166
CALL sp3166_ins();
CALL sp3166_sel();
ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166'
+disconnect user6_4;
+connection default;
CALL sp3166_s_i();
c1
inserted outside SP
@@ -369,6 +406,7 @@ inserted from sp3166_ins
root@localhost db_storedproc_1
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_5, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -377,6 +415,8 @@ CALL sp3166_ins();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_ins'
CALL sp3166_sel();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_sel'
+disconnect user6_5;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp3166_s_i;
diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result
index ca0aff9abbd..bf4fcefb9db 100644
--- a/mysql-test/suite/funcs_1/r/memory_storedproc_10.result
+++ b/mysql-test/suite/funcs_1/r/memory_storedproc_10.result
@@ -82,6 +82,7 @@ create user 'user_2'@'localhost';
GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user2_1, localhost, user_1, , db_storedproc;
user_1@localhost db_storedproc
CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER
@@ -94,6 +95,8 @@ DECLARE res INT;
SET res = n * n;
RETURN res;
END//
+disconnect user2_1;
+connect user2_2, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
@@ -112,6 +115,8 @@ fn31105( 9 )
81
GRANT EXECUTE ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+disconnect user2_2;
+connect user2_3, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
@@ -120,6 +125,7 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
+disconnect user2_3;
connection default;
USE db_storedproc;
@@ -132,12 +138,15 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
+connect user2_4, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
SELECT fn31105( 9 );
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
+disconnect user2_4;
+connection default;
USE db_storedproc;
root@localhost db_storedproc
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03.result b/mysql-test/suite/funcs_1/r/memory_trig_03.result
index 31de6d2759e..8fd3e034735 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03.result
@@ -86,9 +86,13 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.3.2:
-----------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -96,17 +100,20 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.2_1-no';
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.2-no');
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.2_2-yes';
+connection default;
select current_user;
current_user
root@localhost
@@ -125,9 +132,11 @@ trig 3.5.3.2_2-yes
Testcase 3.5.3.6:
-----------------
+connection no_privs;
use priv_db;
drop trigger trg1_2;
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.6-yes');
select f1 from t1 order by f1;
@@ -135,8 +144,10 @@ f1
insert 3.5.3.2-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
+connection yes_privs;
use priv_db;
drop trigger trg1_2;
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.6-no');
select f1 from t1 order by f1;
@@ -145,7 +156,10 @@ insert 3.5.3.2-no
insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
+connection default;
drop trigger trg1_2;
+disconnect no_privs;
+disconnect yes_privs;
Testcase 3.5.3.7a:
------------------
@@ -160,6 +174,9 @@ grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect no_privs_424a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection no_privs_424a;
select current_user;
current_user
test_noprivs@localhost
@@ -175,6 +192,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
create trigger trg4a_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1a';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1a');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -184,6 +202,7 @@ insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
drop trigger trg4a_1;
+connection yes_privs_424a;
use priv_db;
select current_user;
current_user
@@ -193,6 +212,7 @@ Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg4a_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2a';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2b');
select f1 from t1 order by f1;
f1
@@ -202,6 +222,8 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
drop trigger trg4a_2;
+disconnect no_privs_424a;
+disconnect yes_privs_424a;
Testcase 3.5.3.7b:
------------------
@@ -219,6 +241,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
+connect no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424b;
show grants;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -226,6 +252,7 @@ GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEM
use priv_db;
create trigger trg4b_1 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-1b';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1b');
select f1 from t1 order by f1;
f1
@@ -246,6 +273,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
drop trigger trg4b_1;
+connection yes_privs_424b;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -253,6 +281,7 @@ GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4b_2 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-2b';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2b');
select f1 from t1 order by f1;
f1
@@ -274,6 +303,8 @@ trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
drop trigger trg4b_2;
+disconnect no_privs_424b;
+disconnect yes_privs_424b;
Testcase 3.5.3.7c
-----------------
@@ -291,6 +322,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs_424c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424c;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -298,6 +333,7 @@ GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIE
use priv_db;
create trigger trg4c_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1c';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1c');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -310,6 +346,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
drop trigger trg4c_1;
+connection yes_privs_424c;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -317,6 +354,7 @@ GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4c_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2c';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2c');
select f1 from t1 order by f1;
f1
@@ -329,6 +367,8 @@ trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
drop trigger trg4c_2;
+disconnect no_privs_424c;
+disconnect yes_privs_424c;
Testcase 3.5.3.7d:
------------------
@@ -344,6 +384,10 @@ grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs;
Grants for test_noprivs@%
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
+connect no_privs_424d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424d;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -351,6 +395,7 @@ GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
create trigger trg4d_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1d';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1d');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -364,6 +409,7 @@ trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
drop trigger trg4d_1;
+connection yes_privs_424d;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -371,6 +417,7 @@ GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4d_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2d';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2d');
select f1 from t1 order by f1;
f1
@@ -384,6 +431,8 @@ trig 3.5.3.7-2b
trig 3.5.3.7-2c
trig 3.5.3.7-2d
drop trigger trg4d_2;
+disconnect no_privs_424d;
+disconnect yes_privs_424d;
Testcase 3.5.3.8a:
------------------
@@ -398,6 +447,10 @@ grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect no_privs_425a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425a;
select current_user;
current_user
test_noprivs@localhost
@@ -407,6 +460,7 @@ Grants for test_noprivs@localhost
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg5a_1 before INSERT on t1 for each row
set @test_var = new.f1;
+connection default;
set @test_var = 'before trig 3.5.3.8-1a';
select @test_var;
@test_var
@@ -417,6 +471,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1a
drop trigger trg5a_1;
+connection yes_privs_425a;
use priv_db;
select current_user;
current_user
@@ -426,6 +481,7 @@ Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg5a_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-2a';
select @test_var;
@test_var
@@ -435,6 +491,8 @@ select @test_var;
@test_var
insert 3.5.3.8-2a
drop trigger trg5a_2;
+disconnect no_privs_425a;
+disconnect yes_privs_425a;
Testcase: 3.5.3.8b
------------------
@@ -453,6 +511,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
+connect no_privs_425b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425b;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -460,6 +522,7 @@ GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEM
use priv_db;
create trigger trg5b_1 before UPDATE on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-1b';
insert into t1 (f1) values ('insert 3.5.3.8-1b');
select @test_var;
@@ -471,6 +534,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1b
drop trigger trg5b_1;
+connection yes_privs_425b;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -478,6 +542,7 @@ GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5b_2 before UPDATE on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-2b';
insert into t1 (f1) values ('insert 3.5.3.8-2b');
select @test_var;
@@ -488,6 +553,8 @@ select @test_var;
@test_var
update 3.5.3.8-2b
drop trigger trg5b_2;
+disconnect no_privs_425b;
+disconnect yes_privs_425b;
Testcase 3.5.3.8c:
------------------
@@ -506,6 +573,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs_425c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425c;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -513,6 +584,7 @@ GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIE
use priv_db;
create trigger trg5c_1 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-1c';
insert into t1 (f1) values ('insert 3.5.3.8-1c');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
@@ -520,6 +592,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1c
drop trigger trg5c_1;
+connection yes_privs_425c;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -527,12 +600,15 @@ GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5c_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-2c';
insert into t1 (f1) values ('insert 3.5.3.8-2c');
select @test_var;
@test_var
insert 3.5.3.8-2c
drop trigger trg5c_2;
+disconnect no_privs_425c;
+disconnect yes_privs_425c;
Testcase: 3.5.3.8d:
-------------------
@@ -550,6 +626,10 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
+connect no_privs_425d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425d;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -557,6 +637,7 @@ GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
create trigger trg5d_1 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-1d';
insert into t1 (f1) values ('insert 3.5.3.8-1d');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
@@ -564,6 +645,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1d
drop trigger trg5d_1;
+connection yes_privs_425d;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -571,6 +653,7 @@ GRANT SELECT (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5d_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-2d';
insert into t1 (f1) values ('insert 3.5.3.8-2d');
select @test_var;
@@ -594,12 +677,15 @@ Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect yes_353x,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection yes_353x;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1 before insert on t1 for each row
insert into t2 values (new.f1);
+connection default;
use priv_db;
insert into t1 (f1) values (4);
ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -612,10 +698,12 @@ f1
select f2 from t2 order by f2;
f2
4
+connection yes_353x;
use priv_db;
drop trigger trg1;
create trigger trg2 before insert on t1 for each row
update t2 set f2=new.f1-1;
+connection default;
use priv_db;
insert into t1 (f1) values (2);
ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -629,10 +717,12 @@ f1
select f2 from t2 order by f2;
f2
1
+connection yes_353x;
use priv_db;
drop trigger trg2;
create trigger trg3 before insert on t1 for each row
select f2 into @aaa from t2 where f2=new.f1;
+connection default;
use priv_db;
insert into t1 (f1) values (1);
ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -650,10 +740,12 @@ f2
select @aaa;
@aaa
1
+connection yes_353x;
use priv_db;
drop trigger trg3;
create trigger trg4 before insert on t1 for each row
delete from t2;
+connection default;
use priv_db;
insert into t1 (f1) values (1);
ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2'
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result
index cfa839b382c..768e1577177 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result
@@ -25,6 +25,7 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT ON `priv_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
no trigger privilege on db level for create:
--------------------------------------------
@@ -32,11 +33,13 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv_db;
insert into t1 (f1) values ('insert-yes');
select f1 from t1 order by f1;
f1
insert-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -48,12 +51,14 @@ GRANT SELECT, TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
-----------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -63,6 +68,7 @@ ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for colum
select f1 from t1 order by f1;
f1
insert-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -73,6 +79,7 @@ select f1 from t1 order by f1;
f1
insert-yes
trig 1_2-yes
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -83,6 +90,7 @@ f1
insert-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -94,12 +102,14 @@ GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
no trigger privilege on db level for drop:
------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
drop trigger trg1_2;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -117,10 +127,12 @@ trig 1_2-yes
trigger privilege at activation time:
-------------------------------------
+connection default;
select current_user;
current_user
root@localhost
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -135,6 +147,7 @@ trig 1_2-yes
trigger privilege on db level for drop:
---------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -149,6 +162,7 @@ takes effect after use priv_db:
-------------------------------
use priv_db;
drop trigger trg1_2;
+connection default;
select current_user;
current_user
root@localhost
@@ -175,6 +189,7 @@ GRANT SELECT, UPDATE ON `no_priv_db`.* TO 'test_yesprivs'@'localhost'
use db with trigger privilege on db level and without...:
---------------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -192,6 +207,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
use priv_db;
create trigger trg1_4 before UPDATE on t1 for each row
set new.f1 = 'trig 1_4-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -217,6 +233,8 @@ trig 1_2-yes
trig 1_2-yes
trig 1_3-yes
trig 1_3-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -230,6 +248,8 @@ drop trigger trg1_4;
ERROR HY000: Trigger does not exist
use priv_db;
drop trigger trg1_4;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -252,9 +272,12 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
create User test_noprivs@localhost;
set password for test_noprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
no trigger privilege on table level for create:
-----------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -270,6 +293,7 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -280,6 +304,7 @@ t1
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -288,6 +313,7 @@ insert into t1 (f1) values ('insert1-yes');
select f1 from t1 order by f1;
f1
insert1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -309,6 +335,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca
trigger privilege on table level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -316,6 +343,7 @@ show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -325,6 +353,7 @@ f1
insert1-yes
insert2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -343,6 +372,7 @@ GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
no trigger privilege on table level for drop:
---------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -351,6 +381,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
no trigger privilege at activation time:
----------------------------------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -362,6 +393,7 @@ insert1-yes
insert2-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -369,6 +401,7 @@ grant TRIGGER on priv_db.t1 to test_yesprivs@localhost;
trigger privilege at activation time:
-------------------------------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -383,6 +416,7 @@ trig 1_2-yes
trigger privilege on table level for drop:
------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -391,6 +425,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
drop trigger trg1_2;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -403,6 +438,7 @@ insert7-yes
trig 1_2-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -435,6 +471,7 @@ GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t2` TO 'test_noprivs'@'localhost'
use table with trigger privilege and without...:
------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -452,6 +489,7 @@ show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -470,6 +508,8 @@ trig 1_2-yes
trig 1_2-yes
trig 1_2-yes
trig 1_3-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -479,6 +519,8 @@ drop trigger trg1_3;
drop trigger trg2_2;
ERROR HY000: Trigger does not exist
drop trigger trg1_4;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -510,6 +552,9 @@ grant SELECT,INSERT on *.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT SELECT, INSERT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -533,6 +578,7 @@ f1
trig 1_1-yes
trig 1_1-yes
drop trigger priv_db.trg1_5;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -543,6 +589,7 @@ f1
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -558,6 +605,8 @@ revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+disconnect yes_privs;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_yesprivs@localhost
@@ -568,6 +617,7 @@ select * from information_schema.triggers;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
drop trigger trg1_1;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -580,12 +630,14 @@ use priv_db;
no trigger privilege on db level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -598,6 +650,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -609,6 +662,7 @@ GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
-----------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -626,6 +680,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
create trigger priv_db.trg1_9 before UPDATE on priv_db.t1
for each row
set new.f1 = 'trig 1_9-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -646,6 +701,7 @@ f1
insert-yes
drop trigger priv_db.trg1_9;
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -666,6 +722,7 @@ grant TRIGGER on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT ALL PRIVILEGES ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -673,6 +730,7 @@ use no_priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -693,12 +751,16 @@ select f1 from t1 order by f1;
f1
insert-yes
insert-yes
+disconnect yes_privs;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_yesprivs@localhost
use no_priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+disconnect yes_privs;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -721,6 +783,8 @@ f1
insert-yes
insert-yes
trig 1_2-yes
+disconnect no_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -761,11 +825,14 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO 'test_noprivs'@'localhost'
GRANT SELECT, INSERT ON `priv2_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv1_db;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv1_db;
trigger privilege on one db1 db level, not on db2
-------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -778,6 +845,7 @@ use priv2_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig1_1-yes';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -812,6 +880,7 @@ trig 2_1-yes
revoke trigger privilege on table level (not existing)
------------------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -823,6 +892,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT ALL PRIVILEGES ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -833,6 +903,7 @@ ERROR HY000: Trigger does not exist
use priv1_db;
drop trigger trg1_1;
drop trigger trg2_1;
+connection default;
select current_user;
current_user
root@localhost
@@ -841,6 +912,7 @@ revoke TRIGGER on priv1_db.* from test_yesprivs@localhost;
no trigger privilege on table level for create:
-----------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -848,6 +920,7 @@ use priv1_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -863,6 +936,7 @@ GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
trigger privilege on table level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -873,6 +947,7 @@ set new.f1 = 'trig 1_2-yes';
create trigger trg2_1 before INSERT on t2 for each row
set new.f1 = 'trig 2_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -895,6 +970,7 @@ f1
insert1_yes
insert21-yes
insert22-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -905,6 +981,7 @@ GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C4973
GRANT ALL PRIVILEGES ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -914,6 +991,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
use priv1_db;
create trigger trg2_1 before INSERT on t2 for each row
set new.f1 = 'trig 2_1-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -949,11 +1027,15 @@ trig 2_1-yes
trig 2_1-yes
trig 2_1-yes
trig 2_1-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
drop trigger trg1_2;
drop trigger trg2_1;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -974,6 +1056,8 @@ create User test_useprivs@localhost;
set password for test_useprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
select current_user;
current_user
root@localhost
@@ -988,6 +1072,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1001,6 +1086,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')';
+connect use_privs,localhost,test_useprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_useprivs@localhost
@@ -1011,6 +1097,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1019,6 +1106,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1029,6 +1117,7 @@ f1
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert4-no'')';
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1039,6 +1128,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1047,6 +1137,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1057,6 +1148,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert6-no'')';
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1068,6 +1160,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert7-no'')';
+connection default;
select current_user;
current_user
root@localhost
@@ -1076,6 +1169,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1087,6 +1181,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1098,6 +1193,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1106,6 +1202,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1117,6 +1214,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1129,6 +1227,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1137,6 +1236,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1151,6 +1251,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
deallocate prepare ins1;
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1165,6 +1266,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
deallocate prepare ins1;
+connection default;
select current_user;
current_user
root@localhost
@@ -1173,13 +1275,17 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
drop trigger trg1_1;
+connection default;
select current_user;
current_user
root@localhost
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -1196,6 +1302,8 @@ create table t1 (f1 char(20)) engine= memory;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
select current_user;
current_user
root@localhost
@@ -1210,6 +1318,7 @@ before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
grant select, insert, update
on priv_db.t1 to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1220,6 +1329,7 @@ select f1 from t1 order by f1;
f1
drop trigger trg1_0;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -1229,6 +1339,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1257,11 +1368,13 @@ select f1 from t1 order by f1;
f1
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
grant trigger on priv_db.* to test_yesprivs@localhost
with grant option;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1274,9 +1387,12 @@ create definer=not_ex_user@localhost trigger trg1_3
after UPDATE on t1 for each row
set @var1 = 'trig 1_3-yes';
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+connection default;
select current_user;
current_user
root@localhost
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -1307,9 +1423,12 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
update only on column:
----------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1317,6 +1436,7 @@ grant SELECT(f1),INSERT,UPDATE(f1) on priv_db.t1
to test_yesprivs@localhost;
grant SELECT(f1),INSERT,UPDATE(f1) on priv_db.t2
to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1327,6 +1447,7 @@ create trigger trg1_1 before UPDATE on t1 for each row
set new.f1 = 'trig 1_1-yes';
create trigger trg2_1 before UPDATE on t2 for each row
set new.f1 = 'trig 2_1-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1347,6 +1468,7 @@ update t2 set f1 = 'update1_no'
select f1 from t2 order by f1;
f1
trig 2_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1360,12 +1482,14 @@ GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C4973
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT (f1), INSERT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT (f1), INSERT, UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
insert into t1 (f1) values ('insert2-yes');
insert into t2 (f1) values ('insert2-yes');
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1391,6 +1515,7 @@ trig 2_1-yes
check if access only on one of three columns
--------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1398,6 +1523,7 @@ alter table priv_db.t1 add f2 char(20), add f3 int;
revoke TRIGGER on priv_db.* from test_yesprivs@localhost;
grant TRIGGER,SELECT on priv_db.t1 to test_yesprivs@localhost;
grant UPDATE on priv_db.t2 to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1410,6 +1536,7 @@ insert2-yes insert2-yes 1
insert3-yes insert3-yes 2
trig 1_1-yes NULL NULL
trig 1_1-yes NULL NULL
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1424,11 +1551,13 @@ trig 1_1-yes NULL NULL
trig 1_1-yes NULL NULL
trig 1_1-yes update4-yes 10
trig 1_1-yes update4-yes 20
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
create trigger trg1_2 after UPDATE on t1 for each row
set @f2 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1467,10 +1596,12 @@ trig 2_1-yes
check if rejected without trigger privilege:
--------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
revoke TRIGGER on priv_db.t1 from test_yesprivs@localhost;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1490,6 +1621,7 @@ trig 1_2-yes
check trigger, but not update privilege on column:
--------------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1501,6 +1633,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2), TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1508,6 +1641,7 @@ use priv_db;
drop trigger trg1_1;
create trigger trg1_3 before UPDATE on t1 for each row
set new.f1 = 'trig 1_3-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1530,6 +1664,7 @@ NULL
NULL
10
20
+connection default;
select current_user;
current_user
root@localhost
@@ -1541,6 +1676,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2, f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1558,6 +1694,9 @@ NULL
------------------------------------------------
grant TRIGGER(f1) on priv_db.t1 to test_yesprivs@localhost;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(f1) on priv_db.t1 to test_yesprivs@localhost' at line 1
+disconnect yes_privs;
+disconnect no_privs;
+connection default;
select current_user;
current_user
root@localhost
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0407.result b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
index 7f3277f55e1..9b23271958a 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
@@ -69,13 +69,18 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
+connect con1_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect con1_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.4:
---------------
+connection default;
use test;
Testcase 3.5.4.1:
-----------------
+connection con1_super;
create database db_drop;
Use db_drop;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
@@ -83,28 +88,33 @@ grant INSERT, SELECT on db_drop.t1 to test_general;
Use db_drop;
Create trigger trg1 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.1';
+connection con1_general;
Use db_drop;
Insert into t1 values ('Insert error 3.5.4.1');
Select * from t1 order by f1;
f1
Trigger 3.5.4.1
+connection con1_super;
drop trigger trg1;
select trigger_schema, trigger_name, event_object_table
from information_schema.triggers
where trigger_schema = 'db_drop'
order by trigger_name;
trigger_schema trigger_name event_object_table
+connection con1_general;
Insert into t1 values ('Insert no trigger 3.5.4.1');
Select * from t1 order by f1;
f1
Insert no trigger 3.5.4.1
Trigger 3.5.4.1
+connection con1_super;
drop trigger trg1;
drop database if exists db_drop;
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.4.2:
-----------------
+connection con1_super;
create database db_drop2;
Use db_drop2;
drop table if exists t1_432 ;
@@ -116,6 +126,7 @@ drop database if exists db_drop2;
Testcase 3.5.4.3:
-----------------
+connection con1_super;
create database db_drop3;
Use db_drop3;
drop table if exists t1_433 ;
@@ -139,17 +150,20 @@ drop database if exists db_drop3;
Testcase 3.5.4.4:
-----------------
+connection con1_super;
create database db_drop4;
Use db_drop4;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop4.t1 to test_general;
Create trigger trg4 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.4';
+connection con1_general;
Use db_drop4;
Insert into t1 values ('Insert 3.5.4.4');
Select * from t1;
f1
Trigger 3.5.4.4
+connection con1_super;
Drop database db_drop4;
Show databases like 'db_drop4';
Database (db_drop4)
@@ -161,10 +175,12 @@ create database db_drop4;
Use db_drop4;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop4.t1 to test_general;
+connection con1_general;
Insert into t1 values ('2nd Insert 3.5.4.4');
Select * from t1;
f1
2nd Insert 3.5.4.4
+connection con1_super;
drop trigger trg4;
ERROR HY000: Trigger does not exist
drop database if exists db_drop4;
@@ -172,17 +188,20 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.4.5:
-----------------
+connection con1_super;
create database db_drop5;
Use db_drop5;
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
grant INSERT, SELECT on t1 to test_general;
Create trigger trg5 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.5';
+connection con1_general;
Use db_drop5;
Insert into t1 values ('Insert 3.5.4.5');
Select * from t1;
f1
Trigger 3.5.4.5
+connection con1_super;
Drop table t1;
Show tables;
Tables_in_db_drop5
@@ -192,10 +211,12 @@ where information_schema.triggers.trigger_name='trg5';
trigger_schema trigger_name event_object_table
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
grant INSERT, SELECT on t1 to test_general;
+connection con1_general;
Insert into t1 values ('2nd Insert 3.5.4.5');
Select * from t1;
f1
2nd Insert 3.5.4.5
+connection con1_super;
drop trigger trg5;
ERROR HY000: Trigger does not exist
drop database if exists db_drop5;
@@ -203,6 +224,7 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.5:
---------------
+connection default;
use test;
Testcase 3.5.5.1:
@@ -228,6 +250,7 @@ drop view vw3;
Testcase 3.5.5.4:
-----------------
+connection con1_super;
create database dbtest_one;
create database dbtest_two;
use dbtest_two;
@@ -238,6 +261,7 @@ on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4';
ERROR HY000: Trigger in wrong schema
grant INSERT, SELECT on dbtest_two.t2 to test_general;
grant SELECT on dbtest_one.* to test_general;
+connection con1_general;
use dbtest_two;
Insert into t2 values ('1st Insert 3.5.5.4');
Warnings:
@@ -253,12 +277,14 @@ Select * from dbtest_two.t2 order by f1;
f1
1st Insert 3.5.
2nd Insert 3.5.
+connection con1_super;
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
DROP DATABASE if exists dbtest_one;
drop database if EXISTS dbtest_two;
Testcase 3.5.6:
---------------
+connection default;
use test;
Testcase 3.5.6.1 (see Testcase 3.5.1.1)
@@ -466,6 +492,7 @@ delete from tb3 where f121='Test 3.5.7.15/16';
Testcase 3.5.7.17 (see Testcase 3.5.1.1)
----------------------------------------
+connection default;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_08.result b/mysql-test/suite/funcs_1/r/memory_trig_08.result
index 4632cfe269c..11bc3b61054 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_08.result
@@ -69,6 +69,9 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
+connect con2_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect con2_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.8.1: (implied in previous tests)
---------------------------------------------
@@ -78,6 +81,7 @@ Testcase 3.5.8.2: (implied in previous tests)
Testcase 3.5.8.3/4:
-------------------
+connection con2_super;
create database db_test;
grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general;
grant LOCK TABLES on db_test.* to test_general;
@@ -124,6 +128,7 @@ delete from db_test.t1_d where d136= new.f136;
select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u
where u136= new.f136;
END//
+connection con2_general;
Use test;
set @test_var=0;
Insert into tb3 (f120, f122, f136, f144, f163)
@@ -153,11 +158,13 @@ select @test_var;
3.5.8.4 - single SQL - insert
-----------------------------
+connection con2_super;
Create trigger trg2 BEFORE UPDATE on tb3 for each row
BEGIN
insert into db_test.t1_i
values (new.f120, new.f136, new.f144, new.f163);
END//
+connection con2_general;
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
f120 f122 f136 f144 f163
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
@@ -176,11 +183,13 @@ I 00222 0000023456 1.050000000000000000000000000000
3.5.8.4 - single SQL - update
-----------------------------
+connection con2_super;
drop trigger trg2;
Create trigger trg3 BEFORE UPDATE on tb3 for each row
update db_test.t1_u
set u120=new.f120
where u136=new.f136;
+connection con2_general;
update tb3 set f120='U', f122='Test 3.5.8.4-Single Update'
where f122='Test 3.5.8.4-Single Insert';
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
@@ -197,9 +206,11 @@ U 00222 0000023456 1.050000000000000000000000000000
3.5.8.3/4 - single SQL - delete
-------------------------------
+connection con2_super;
drop trigger trg3;
Create trigger trg4 AFTER UPDATE on tb3 for each row
delete from db_test.t1_d where d136= new.f136;
+connection con2_general;
update tb3 set f120='D', f136=444,
f122='Test 3.5.8.4-Single Delete'
where f122='Test 3.5.8.4-Single Update';
@@ -213,10 +224,12 @@ c 00333 0000099999 999.990000000000000000000000000000
3.5.8.3/4 - single SQL - select
-------------------------------
+connection con2_super;
drop trigger trg4;
Create trigger trg5 AFTER UPDATE on tb3 for each row
select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u
where u136= new.f136;
+connection con2_general;
set @test_var=0;
update tb3 set f120='S', f136=111,
f122='Test 3.5.8.4-Single Select'
@@ -227,6 +240,7 @@ S Test 3.5.8.4-Single Select 00111 0000023456 1.050000000000000000000000000000
select @test_var;
@test_var
999.990000000000000000000000000000
+connection default;
drop trigger trg1;
drop trigger trg5;
drop database if exists db_test;
@@ -519,6 +533,7 @@ Set @var2=old.f120;
Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+connection default;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
index c38481bac50..a0a48842ef8 100644
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result
@@ -66,6 +66,7 @@ load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/t4.txt' into table t11;
Section 3.1.6 - Privilege Checks:
--------------------------------------------------------------------------------
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -80,6 +81,7 @@ grant all on db_storedproc_1.* to 'user_1'@'localhost';
revoke create routine on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS sp1;
+connect user1a, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -88,10 +90,13 @@ BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
ERROR 42000: Access denied for user 'user_1'@'localhost' to database 'db_storedproc_1'
+disconnect user1a;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
+connect user1b, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -99,6 +104,8 @@ CREATE PROCEDURE sp1(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
+disconnect user1b;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -114,6 +121,7 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
DROP PROCEDURE IF EXISTS db_storedproc_1.sp3;
DROP FUNCTION IF EXISTS db_storedproc_1.fn1;
+connect user2, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3(v1 char(20))
@@ -124,6 +132,8 @@ CREATE FUNCTION fn1(v1 int) returns int
BEGIN
return v1;
END//
+disconnect user2;
+connection default;
USE db_storedproc_1;
root@localhost db_storedproc_1
@@ -146,6 +156,7 @@ CREATE PROCEDURE sp4(v1 char(20))
BEGIN
SELECT * from db_storedproc_1.t6 where t6.f2= 'xyz';
END//
+connect user3, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
USE db_storedproc_1;
@@ -167,6 +178,8 @@ SQL_DATA_ACCESS CONTAINS SQL
SECURITY_TYPE DEFINER
SQL_MODE NO_ENGINE_SUBSTITUTION
ROUTINE_COMMENT
+disconnect user3;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp4;
@@ -187,6 +200,7 @@ grant create routine on db_storedproc_1.* to 'user_1'@'localhost';
grant SELECT on db_storedproc_1.* to 'user_2'@'localhost';
grant execute on db_storedproc_1.* to 'user_2'@'localhost';
flush privileges;
+connect user5_1, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp5_s_i () sql security definer
@@ -202,6 +216,8 @@ CREATE PROCEDURE sp5_ins () sql security definer
BEGIN
insert into db_storedproc_1.t3165 values ('inserted', 'from sp5_ins', 1000);
END//
+disconnect user5_1;
+connect user5_2, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -210,12 +226,14 @@ CALL sp5_ins();
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+connection default;
root@localhost db_storedproc_1
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
grant insert on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -223,12 +241,14 @@ ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165
CALL sp5_ins();
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+connection default;
root@localhost db_storedproc_1
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
grant SELECT on db_storedproc_1.* to 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -242,10 +262,12 @@ inserted outside of SP NULL
inserted from sp5_ins 2000-10-00
inserted from sp5_s_i 2000-10-00
inserted from sp5_ins 2000-10-00
+connection default;
root@localhost db_storedproc_1
REVOKE INSERT on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -263,10 +285,12 @@ inserted outside of SP NULL
inserted from sp5_ins 2000-10-00
inserted from sp5_s_i 2000-10-00
inserted from sp5_ins 2000-10-00
+connection default;
root@localhost db_storedproc_1
REVOKE SELECT on db_storedproc_1.* from 'user_1'@'localhost';
flush privileges;
+connection user5_2;
user_2@localhost db_storedproc_1
CALL sp5_s_i();
@@ -275,6 +299,8 @@ CALL sp5_ins();
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't3165'
CALL sp5_sel();
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't3165'
+disconnect user5_2;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp5_s_i;
@@ -299,6 +325,7 @@ GRANT CREATE ROUTINE ON db_storedproc_1.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc_1.* TO 'user_2'@'localhost';
GRANT EXECUTE ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_1, localhost, user_1, , db_storedproc_1;
user_1@localhost db_storedproc_1
CREATE PROCEDURE sp3166_s_i () SQL SECURITY INVOKER
@@ -314,6 +341,8 @@ CREATE PROCEDURE sp3166_ins () SQL SECURITY INVOKER
BEGIN
insert into db_storedproc_1.t3166 values ('inserted from sp3166_ins');
END//
+disconnect user6_1;
+connect user6_2, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -325,6 +354,7 @@ ERROR 42000: INSERT command denied to user 'user_2'@'localhost' for table 't3166
CALL sp3166_sel();
c1
inserted outside SP
+connection default;
root@localhost db_storedproc_1
CALL sp3166_sel();
@@ -332,6 +362,8 @@ c1
inserted outside SP
GRANT INSERT ON db_storedproc_1.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+disconnect user6_2;
+connect user6_3, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -343,6 +375,8 @@ c1
inserted outside SP
inserted from sp3166_s_i
inserted from sp3166_ins
+disconnect user6_3;
+connection default;
root@localhost db_storedproc_1
CALL sp3166_sel();
@@ -352,6 +386,7 @@ inserted from sp3166_s_i
inserted from sp3166_ins
REVOKE SELECT ON db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_4, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -359,6 +394,8 @@ ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166
CALL sp3166_ins();
CALL sp3166_sel();
ERROR 42000: SELECT command denied to user 'user_2'@'localhost' for table 't3166'
+disconnect user6_4;
+connection default;
CALL sp3166_s_i();
c1
inserted outside SP
@@ -369,6 +406,7 @@ inserted from sp3166_ins
root@localhost db_storedproc_1
REVOKE EXECUTE on db_storedproc_1.* FROM 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user6_5, localhost, user_2, , db_storedproc_1;
user_2@localhost db_storedproc_1
CALL sp3166_s_i();
@@ -377,6 +415,8 @@ CALL sp3166_ins();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_ins'
CALL sp3166_sel();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc_1.sp3166_sel'
+disconnect user6_5;
+connection default;
root@localhost db_storedproc_1
DROP PROCEDURE sp3166_s_i;
diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result
index ca0aff9abbd..bf4fcefb9db 100644
--- a/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result
+++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_10.result
@@ -82,6 +82,7 @@ create user 'user_2'@'localhost';
GRANT CREATE ROUTINE ON db_storedproc.* TO 'user_1'@'localhost';
GRANT SELECT ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+connect user2_1, localhost, user_1, , db_storedproc;
user_1@localhost db_storedproc
CREATE PROCEDURE sp31102 () SQL SECURITY INVOKER
@@ -94,6 +95,8 @@ DECLARE res INT;
SET res = n * n;
RETURN res;
END//
+disconnect user2_1;
+connect user2_2, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
@@ -112,6 +115,8 @@ fn31105( 9 )
81
GRANT EXECUTE ON db_storedproc.* TO 'user_2'@'localhost';
FLUSH PRIVILEGES;
+disconnect user2_2;
+connect user2_3, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
@@ -120,6 +125,7 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
+disconnect user2_3;
connection default;
USE db_storedproc;
@@ -132,12 +138,15 @@ a` a` 1000-01-01 -5000 a` -5000
SELECT fn31105( 9 );
fn31105( 9 )
81
+connect user2_4, localhost, user_2, , db_storedproc;
user_2@localhost db_storedproc
CALL sp31102();
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.sp31102'
SELECT fn31105( 9 );
ERROR 42000: execute command denied to user 'user_2'@'localhost' for routine 'db_storedproc.fn31105'
+disconnect user2_4;
+connection default;
USE db_storedproc;
root@localhost db_storedproc
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03.result b/mysql-test/suite/funcs_1/r/myisam_trig_03.result
index 31de6d2759e..8fd3e034735 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03.result
@@ -86,9 +86,13 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.3.2:
-----------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -96,17 +100,20 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.2_1-no';
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.2-no');
select f1 from t1 order by f1;
f1
insert 3.5.3.2-no
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.2_2-yes';
+connection default;
select current_user;
current_user
root@localhost
@@ -125,9 +132,11 @@ trig 3.5.3.2_2-yes
Testcase 3.5.3.6:
-----------------
+connection no_privs;
use priv_db;
drop trigger trg1_2;
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.6-yes');
select f1 from t1 order by f1;
@@ -135,8 +144,10 @@ f1
insert 3.5.3.2-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
+connection yes_privs;
use priv_db;
drop trigger trg1_2;
+connection default;
use priv_db;
insert into t1 (f1) values ('insert 3.5.3.6-no');
select f1 from t1 order by f1;
@@ -145,7 +156,10 @@ insert 3.5.3.2-no
insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
+connection default;
drop trigger trg1_2;
+disconnect no_privs;
+disconnect yes_privs;
Testcase 3.5.3.7a:
------------------
@@ -160,6 +174,9 @@ grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect no_privs_424a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection no_privs_424a;
select current_user;
current_user
test_noprivs@localhost
@@ -175,6 +192,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
create trigger trg4a_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1a';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1a');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -184,6 +202,7 @@ insert 3.5.3.6-no
trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
drop trigger trg4a_1;
+connection yes_privs_424a;
use priv_db;
select current_user;
current_user
@@ -193,6 +212,7 @@ Grants for test_yesprivs@localhost
GRANT UPDATE, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg4a_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2a';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2b');
select f1 from t1 order by f1;
f1
@@ -202,6 +222,8 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
drop trigger trg4a_2;
+disconnect no_privs_424a;
+disconnect yes_privs_424a;
Testcase 3.5.3.7b:
------------------
@@ -219,6 +241,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
+connect no_privs_424b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424b;
show grants;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -226,6 +252,7 @@ GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEM
use priv_db;
create trigger trg4b_1 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-1b';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1b');
select f1 from t1 order by f1;
f1
@@ -246,6 +273,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
drop trigger trg4b_1;
+connection yes_privs_424b;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -253,6 +281,7 @@ GRANT UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4b_2 before UPDATE on t1 for each row
set new.f1 = 'trig 3.5.3.7-2b';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2b');
select f1 from t1 order by f1;
f1
@@ -274,6 +303,8 @@ trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
drop trigger trg4b_2;
+disconnect no_privs_424b;
+disconnect yes_privs_424b;
Testcase 3.5.3.7c
-----------------
@@ -291,6 +322,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs_424c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424c;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -298,6 +333,7 @@ GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIE
use priv_db;
create trigger trg4c_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1c';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1c');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -310,6 +346,7 @@ trig 3.5.3.2_2-yes
trig 3.5.3.7-2a
trig 3.5.3.7-2b
drop trigger trg4c_1;
+connection yes_privs_424c;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -317,6 +354,7 @@ GRANT UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4c_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2c';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2c');
select f1 from t1 order by f1;
f1
@@ -329,6 +367,8 @@ trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
drop trigger trg4c_2;
+disconnect no_privs_424c;
+disconnect yes_privs_424c;
Testcase 3.5.3.7d:
------------------
@@ -344,6 +384,10 @@ grant UPDATE (f1) on priv_db.t1 to test_yesprivs@localhost;
show grants for test_noprivs;
Grants for test_noprivs@%
GRANT TRIGGER ON *.* TO 'test_noprivs'@'%'
+connect no_privs_424d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_424d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_424d;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -351,6 +395,7 @@ GRANT SELECT (f1), INSERT (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
create trigger trg4d_1 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-1d';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-1d');
ERROR 42000: UPDATE command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
select f1 from t1 order by f1;
@@ -364,6 +409,7 @@ trig 3.5.3.7-2a
trig 3.5.3.7-2b
trig 3.5.3.7-2c
drop trigger trg4d_1;
+connection yes_privs_424d;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -371,6 +417,7 @@ GRANT UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg4d_2 before INSERT on t1 for each row
set new.f1 = 'trig 3.5.3.7-2d';
+connection default;
insert into t1 (f1) values ('insert 3.5.3.7-2d');
select f1 from t1 order by f1;
f1
@@ -384,6 +431,8 @@ trig 3.5.3.7-2b
trig 3.5.3.7-2c
trig 3.5.3.7-2d
drop trigger trg4d_2;
+disconnect no_privs_424d;
+disconnect yes_privs_424d;
Testcase 3.5.3.8a:
------------------
@@ -398,6 +447,10 @@ grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect no_privs_425a,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425a,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425a;
select current_user;
current_user
test_noprivs@localhost
@@ -407,6 +460,7 @@ Grants for test_noprivs@localhost
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg5a_1 before INSERT on t1 for each row
set @test_var = new.f1;
+connection default;
set @test_var = 'before trig 3.5.3.8-1a';
select @test_var;
@test_var
@@ -417,6 +471,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1a
drop trigger trg5a_1;
+connection yes_privs_425a;
use priv_db;
select current_user;
current_user
@@ -426,6 +481,7 @@ Grants for test_yesprivs@localhost
GRANT SELECT, TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
create trigger trg5a_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-2a';
select @test_var;
@test_var
@@ -435,6 +491,8 @@ select @test_var;
@test_var
insert 3.5.3.8-2a
drop trigger trg5a_2;
+disconnect no_privs_425a;
+disconnect yes_privs_425a;
Testcase: 3.5.3.8b
------------------
@@ -453,6 +511,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
+connect no_privs_425b,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425b,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425b;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -460,6 +522,7 @@ GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEM
use priv_db;
create trigger trg5b_1 before UPDATE on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-1b';
insert into t1 (f1) values ('insert 3.5.3.8-1b');
select @test_var;
@@ -471,6 +534,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1b
drop trigger trg5b_1;
+connection yes_privs_425b;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -478,6 +542,7 @@ GRANT SELECT ON `priv_db`.* TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5b_2 before UPDATE on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-2b';
insert into t1 (f1) values ('insert 3.5.3.8-2b');
select @test_var;
@@ -488,6 +553,8 @@ select @test_var;
@test_var
update 3.5.3.8-2b
drop trigger trg5b_2;
+disconnect no_privs_425b;
+disconnect yes_privs_425b;
Testcase 3.5.3.8c:
------------------
@@ -506,6 +573,10 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect no_privs_425c,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425c,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425c;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -513,6 +584,7 @@ GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIE
use priv_db;
create trigger trg5c_1 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var= 'before trig 3.5.3.8-1c';
insert into t1 (f1) values ('insert 3.5.3.8-1c');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
@@ -520,6 +592,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1c
drop trigger trg5c_1;
+connection yes_privs_425c;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -527,12 +600,15 @@ GRANT SELECT ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5c_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-2c';
insert into t1 (f1) values ('insert 3.5.3.8-2c');
select @test_var;
@test_var
insert 3.5.3.8-2c
drop trigger trg5c_2;
+disconnect no_privs_425c;
+disconnect yes_privs_425c;
Testcase: 3.5.3.8d:
-------------------
@@ -550,6 +626,10 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
+connect no_privs_425d,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect yes_privs_425d,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
+connection no_privs_425d;
show grants;
Grants for test_noprivs@localhost
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -557,6 +637,7 @@ GRANT INSERT (f1), UPDATE (f1) ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
use priv_db;
create trigger trg5d_1 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-1d';
insert into t1 (f1) values ('insert 3.5.3.8-1d');
ERROR 42000: SELECT command denied to user 'test_noprivs'@'localhost' for column 'f1' in table 't1'
@@ -564,6 +645,7 @@ select @test_var;
@test_var
before trig 3.5.3.8-1d
drop trigger trg5d_1;
+connection yes_privs_425d;
show grants;
Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
@@ -571,6 +653,7 @@ GRANT SELECT (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
use priv_db;
create trigger trg5d_2 before INSERT on t1 for each row
set @test_var= new.f1;
+connection default;
set @test_var='before trig 3.5.3.8-2d';
insert into t1 (f1) values ('insert 3.5.3.8-2d');
select @test_var;
@@ -594,12 +677,15 @@ Grants for test_yesprivs@localhost
GRANT TRIGGER ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connect yes_353x,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection yes_353x;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1 before insert on t1 for each row
insert into t2 values (new.f1);
+connection default;
use priv_db;
insert into t1 (f1) values (4);
ERROR 42000: INSERT command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -612,10 +698,12 @@ f1
select f2 from t2 order by f2;
f2
4
+connection yes_353x;
use priv_db;
drop trigger trg1;
create trigger trg2 before insert on t1 for each row
update t2 set f2=new.f1-1;
+connection default;
use priv_db;
insert into t1 (f1) values (2);
ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -629,10 +717,12 @@ f1
select f2 from t2 order by f2;
f2
1
+connection yes_353x;
use priv_db;
drop trigger trg2;
create trigger trg3 before insert on t1 for each row
select f2 into @aaa from t2 where f2=new.f1;
+connection default;
use priv_db;
insert into t1 (f1) values (1);
ERROR 42000: SELECT command denied to user 'test_yesprivs'@'localhost' for table 't2'
@@ -650,10 +740,12 @@ f2
select @aaa;
@aaa
1
+connection yes_353x;
use priv_db;
drop trigger trg3;
create trigger trg4 before insert on t1 for each row
delete from t2;
+connection default;
use priv_db;
insert into t1 (f1) values (1);
ERROR 42000: DELETE command denied to user 'test_yesprivs'@'localhost' for table 't2'
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
index fd796dd4550..420bdf2dc2d 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result
@@ -25,6 +25,7 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT ON `priv_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
no trigger privilege on db level for create:
--------------------------------------------
@@ -32,11 +33,13 @@ use priv_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv_db;
insert into t1 (f1) values ('insert-yes');
select f1 from t1 order by f1;
f1
insert-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -48,12 +51,14 @@ GRANT SELECT, TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
-----------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -63,6 +68,7 @@ ERROR 42000: UPDATE command denied to user 'test_yesprivs'@'localhost' for colum
select f1 from t1 order by f1;
f1
insert-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -73,6 +79,7 @@ select f1 from t1 order by f1;
f1
insert-yes
trig 1_2-yes
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -83,6 +90,7 @@ f1
insert-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -94,12 +102,14 @@ GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_yesprivs'@'localhost'
no trigger privilege on db level for drop:
------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
drop trigger trg1_2;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -117,10 +127,12 @@ trig 1_2-yes
trigger privilege at activation time:
-------------------------------------
+connection default;
select current_user;
current_user
root@localhost
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -135,6 +147,7 @@ trig 1_2-yes
trigger privilege on db level for drop:
---------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -149,6 +162,7 @@ takes effect after use priv_db:
-------------------------------
use priv_db;
drop trigger trg1_2;
+connection default;
select current_user;
current_user
root@localhost
@@ -175,6 +189,7 @@ GRANT SELECT, UPDATE ON `no_priv_db`.* TO 'test_yesprivs'@'localhost'
use db with trigger privilege on db level and without...:
---------------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -192,6 +207,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
use priv_db;
create trigger trg1_4 before UPDATE on t1 for each row
set new.f1 = 'trig 1_4-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -217,6 +233,8 @@ trig 1_2-yes
trig 1_2-yes
trig 1_3-yes
trig 1_3-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -230,6 +248,8 @@ drop trigger trg1_4;
ERROR HY000: Trigger does not exist
use priv_db;
drop trigger trg1_4;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -252,9 +272,12 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
create User test_noprivs@localhost;
set password for test_noprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_noprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
no trigger privilege on table level for create:
-----------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -270,6 +293,7 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -280,6 +304,7 @@ t1
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -288,6 +313,7 @@ insert into t1 (f1) values ('insert1-yes');
select f1 from t1 order by f1;
f1
insert1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -309,6 +335,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca
trigger privilege on table level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -316,6 +343,7 @@ show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -325,6 +353,7 @@ f1
insert1-yes
insert2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -343,6 +372,7 @@ GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
no trigger privilege on table level for drop:
---------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -351,6 +381,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
no trigger privilege at activation time:
----------------------------------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -362,6 +393,7 @@ insert1-yes
insert2-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -369,6 +401,7 @@ grant TRIGGER on priv_db.t1 to test_yesprivs@localhost;
trigger privilege at activation time:
-------------------------------------
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -383,6 +416,7 @@ trig 1_2-yes
trigger privilege on table level for drop:
------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -391,6 +425,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
drop trigger trg1_2;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -403,6 +438,7 @@ insert7-yes
trig 1_2-yes
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -435,6 +471,7 @@ GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t2` TO 'test_noprivs'@'localhost'
use table with trigger privilege and without...:
------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -452,6 +489,7 @@ show triggers;
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg1_3 INSERT t1 set new.f1 = 'trig 1_3-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
trg1_4 UPDATE t1 set new.f1 = 'trig 1_4-yes' BEFORE NULL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION test_yesprivs@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -470,6 +508,8 @@ trig 1_2-yes
trig 1_2-yes
trig 1_2-yes
trig 1_3-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -479,6 +519,8 @@ drop trigger trg1_3;
drop trigger trg2_2;
ERROR HY000: Trigger does not exist
drop trigger trg1_4;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -510,6 +552,9 @@ grant SELECT,INSERT on *.* to test_noprivs@localhost;
show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT SELECT, INSERT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -533,6 +578,7 @@ f1
trig 1_1-yes
trig 1_1-yes
drop trigger priv_db.trg1_5;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -543,6 +589,7 @@ f1
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -558,6 +605,8 @@ revoke TRIGGER on *.* from test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+disconnect yes_privs;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_yesprivs@localhost
@@ -568,6 +617,7 @@ select * from information_schema.triggers;
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
drop trigger trg1_1;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -580,12 +630,14 @@ use priv_db;
no trigger privilege on db level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -598,6 +650,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -609,6 +662,7 @@ GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
trigger privilege on db level for create:
-----------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -626,6 +680,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
create trigger priv_db.trg1_9 before UPDATE on priv_db.t1
for each row
set new.f1 = 'trig 1_9-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -646,6 +701,7 @@ f1
insert-yes
drop trigger priv_db.trg1_9;
ERROR 42000: TRIGGER command denied to user 'test_noprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -666,6 +722,7 @@ grant TRIGGER on *.* to test_yesprivs@localhost;
show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT ALL PRIVILEGES ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -673,6 +730,7 @@ use no_priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -693,12 +751,16 @@ select f1 from t1 order by f1;
f1
insert-yes
insert-yes
+disconnect yes_privs;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_yesprivs@localhost
use no_priv_db;
create trigger trg1_2 before INSERT on t1 for each row
set new.f1 = 'trig 1_2-yes';
+disconnect yes_privs;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -721,6 +783,8 @@ f1
insert-yes
insert-yes
trig 1_2-yes
+disconnect no_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -761,11 +825,14 @@ Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv1_db`.* TO 'test_noprivs'@'localhost'
GRANT SELECT, INSERT ON `priv2_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv1_db;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
use priv1_db;
trigger privilege on one db1 db level, not on db2
-------------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -778,6 +845,7 @@ use priv2_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig1_1-yes';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -812,6 +880,7 @@ trig 2_1-yes
revoke trigger privilege on table level (not existing)
------------------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -823,6 +892,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT ALL PRIVILEGES ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -833,6 +903,7 @@ ERROR HY000: Trigger does not exist
use priv1_db;
drop trigger trg1_1;
drop trigger trg2_1;
+connection default;
select current_user;
current_user
root@localhost
@@ -841,6 +912,7 @@ revoke TRIGGER on priv1_db.* from test_yesprivs@localhost;
no trigger privilege on table level for create:
-----------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -848,6 +920,7 @@ use priv1_db;
create trigger trg1_1 before INSERT on t1 for each row
set new.f1 = 'trig 1_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -863,6 +936,7 @@ GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
trigger privilege on table level for create:
--------------------------------------------
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -873,6 +947,7 @@ set new.f1 = 'trig 1_2-yes';
create trigger trg2_1 before INSERT on t2 for each row
set new.f1 = 'trig 2_1-no';
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't2'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -895,6 +970,7 @@ f1
insert1_yes
insert21-yes
insert22-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -905,6 +981,7 @@ GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C4973
GRANT ALL PRIVILEGES ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -914,6 +991,7 @@ ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for tabl
use priv1_db;
create trigger trg2_1 before INSERT on t2 for each row
set new.f1 = 'trig 2_1-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -949,11 +1027,15 @@ trig 2_1-yes
trig 2_1-yes
trig 2_1-yes
trig 2_1-yes
+disconnect no_privs;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
drop trigger trg1_2;
drop trigger trg2_1;
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -974,6 +1056,8 @@ create User test_useprivs@localhost;
set password for test_useprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
revoke ALL PRIVILEGES, GRANT OPTION FROM test_useprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
select current_user;
current_user
root@localhost
@@ -988,6 +1072,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1001,6 +1086,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert2-no'')';
+connect use_privs,localhost,test_useprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
select current_user;
current_user
test_useprivs@localhost
@@ -1011,6 +1097,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1019,6 +1106,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1029,6 +1117,7 @@ f1
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert4-no'')';
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1039,6 +1128,7 @@ select f1 from t1 order by f1;
f1
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1047,6 +1137,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1057,6 +1148,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert6-no'')';
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1068,6 +1160,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
prepare ins1 from 'insert into t1 (f1) values (''insert7-no'')';
+connection default;
select current_user;
current_user
root@localhost
@@ -1076,6 +1169,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1087,6 +1181,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1098,6 +1193,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1106,6 +1202,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1117,6 +1214,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1129,6 +1227,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1137,6 +1236,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1151,6 +1251,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
deallocate prepare ins1;
+connection use_privs;
select current_user;
current_user
test_useprivs@localhost
@@ -1165,6 +1266,7 @@ trig 1_1-yes
trig 1_1-yes
trig 1_1-yes
deallocate prepare ins1;
+connection default;
select current_user;
current_user
root@localhost
@@ -1173,13 +1275,17 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost' WITH GRANT OPTION
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
drop trigger trg1_1;
+connection default;
select current_user;
current_user
root@localhost
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -1196,6 +1302,8 @@ create table t1 (f1 char(20)) engine= myisam;
create User test_yesprivs@localhost;
set password for test_yesprivs@localhost = password('PWD');
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
select current_user;
current_user
root@localhost
@@ -1210,6 +1318,7 @@ before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
grant select, insert, update
on priv_db.t1 to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1220,6 +1329,7 @@ select f1 from t1 order by f1;
f1
drop trigger trg1_0;
ERROR 42000: TRIGGER command denied to user 'test_yesprivs'@'localhost' for table 't1'
+connection default;
select current_user;
current_user
root@localhost
@@ -1229,6 +1339,7 @@ show grants for test_yesprivs@localhost;
Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1257,11 +1368,13 @@ select f1 from t1 order by f1;
f1
trig 1_2-yes
trig 1_2-yes
+connection default;
select current_user;
current_user
root@localhost
grant trigger on priv_db.* to test_yesprivs@localhost
with grant option;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1274,9 +1387,12 @@ create definer=not_ex_user@localhost trigger trg1_3
after UPDATE on t1 for each row
set @var1 = 'trig 1_3-yes';
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
+connection default;
select current_user;
current_user
root@localhost
+disconnect yes_privs;
+connection default;
select current_user;
current_user
root@localhost
@@ -1307,9 +1423,12 @@ show grants for test_noprivs@localhost;
Grants for test_noprivs@localhost
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT, UPDATE ON `priv_db`.* TO 'test_noprivs'@'localhost'
+connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect no_privs,localhost,test_noprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
update only on column:
----------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1317,6 +1436,7 @@ grant SELECT(f1),INSERT,UPDATE(f1) on priv_db.t1
to test_yesprivs@localhost;
grant SELECT(f1),INSERT,UPDATE(f1) on priv_db.t2
to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1327,6 +1447,7 @@ create trigger trg1_1 before UPDATE on t1 for each row
set new.f1 = 'trig 1_1-yes';
create trigger trg2_1 before UPDATE on t2 for each row
set new.f1 = 'trig 2_1-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1347,6 +1468,7 @@ update t2 set f1 = 'update1_no'
select f1 from t2 order by f1;
f1
trig 2_1-yes
+connection default;
select current_user;
current_user
root@localhost
@@ -1360,12 +1482,14 @@ GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C4973
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
GRANT SELECT (f1), INSERT ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT (f1), INSERT, UPDATE (f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
use priv_db;
insert into t1 (f1) values ('insert2-yes');
insert into t2 (f1) values ('insert2-yes');
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1391,6 +1515,7 @@ trig 2_1-yes
check if access only on one of three columns
--------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1398,6 +1523,7 @@ alter table priv_db.t1 add f2 char(20), add f3 int;
revoke TRIGGER on priv_db.* from test_yesprivs@localhost;
grant TRIGGER,SELECT on priv_db.t1 to test_yesprivs@localhost;
grant UPDATE on priv_db.t2 to test_yesprivs@localhost;
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1410,6 +1536,7 @@ insert2-yes insert2-yes 1
insert3-yes insert3-yes 2
trig 1_1-yes NULL NULL
trig 1_1-yes NULL NULL
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1424,11 +1551,13 @@ trig 1_1-yes NULL NULL
trig 1_1-yes NULL NULL
trig 1_1-yes update4-yes 10
trig 1_1-yes update4-yes 20
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
create trigger trg1_2 after UPDATE on t1 for each row
set @f2 = 'trig 1_2-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1467,10 +1596,12 @@ trig 2_1-yes
check if rejected without trigger privilege:
--------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
revoke TRIGGER on priv_db.t1 from test_yesprivs@localhost;
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1490,6 +1621,7 @@ trig 1_2-yes
check trigger, but not update privilege on column:
--------------------------------------------------
+connection default;
select current_user;
current_user
root@localhost
@@ -1501,6 +1633,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2), TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection yes_privs;
select current_user;
current_user
test_yesprivs@localhost
@@ -1508,6 +1641,7 @@ use priv_db;
drop trigger trg1_1;
create trigger trg1_3 before UPDATE on t1 for each row
set new.f1 = 'trig 1_3-yes';
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1530,6 +1664,7 @@ NULL
NULL
10
20
+connection default;
select current_user;
current_user
root@localhost
@@ -1541,6 +1676,7 @@ Grants for test_yesprivs@localhost
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
GRANT SELECT (f1), INSERT, UPDATE ON `priv_db`.`t2` TO 'test_yesprivs'@'localhost'
GRANT SELECT, SELECT (f1), INSERT, UPDATE (f3, f2, f1) ON `priv_db`.`t1` TO 'test_yesprivs'@'localhost'
+connection no_privs;
select current_user;
current_user
test_noprivs@localhost
@@ -1558,6 +1694,9 @@ NULL
------------------------------------------------
grant TRIGGER(f1) on priv_db.t1 to test_yesprivs@localhost;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(f1) on priv_db.t1 to test_yesprivs@localhost' at line 1
+disconnect yes_privs;
+disconnect no_privs;
+connection default;
select current_user;
current_user
root@localhost
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
index 7f3277f55e1..9b23271958a 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
@@ -69,13 +69,18 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
+connect con1_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect con1_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.4:
---------------
+connection default;
use test;
Testcase 3.5.4.1:
-----------------
+connection con1_super;
create database db_drop;
Use db_drop;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
@@ -83,28 +88,33 @@ grant INSERT, SELECT on db_drop.t1 to test_general;
Use db_drop;
Create trigger trg1 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.1';
+connection con1_general;
Use db_drop;
Insert into t1 values ('Insert error 3.5.4.1');
Select * from t1 order by f1;
f1
Trigger 3.5.4.1
+connection con1_super;
drop trigger trg1;
select trigger_schema, trigger_name, event_object_table
from information_schema.triggers
where trigger_schema = 'db_drop'
order by trigger_name;
trigger_schema trigger_name event_object_table
+connection con1_general;
Insert into t1 values ('Insert no trigger 3.5.4.1');
Select * from t1 order by f1;
f1
Insert no trigger 3.5.4.1
Trigger 3.5.4.1
+connection con1_super;
drop trigger trg1;
drop database if exists db_drop;
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.4.2:
-----------------
+connection con1_super;
create database db_drop2;
Use db_drop2;
drop table if exists t1_432 ;
@@ -116,6 +126,7 @@ drop database if exists db_drop2;
Testcase 3.5.4.3:
-----------------
+connection con1_super;
create database db_drop3;
Use db_drop3;
drop table if exists t1_433 ;
@@ -139,17 +150,20 @@ drop database if exists db_drop3;
Testcase 3.5.4.4:
-----------------
+connection con1_super;
create database db_drop4;
Use db_drop4;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop4.t1 to test_general;
Create trigger trg4 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.4';
+connection con1_general;
Use db_drop4;
Insert into t1 values ('Insert 3.5.4.4');
Select * from t1;
f1
Trigger 3.5.4.4
+connection con1_super;
Drop database db_drop4;
Show databases like 'db_drop4';
Database (db_drop4)
@@ -161,10 +175,12 @@ create database db_drop4;
Use db_drop4;
create table t1 (f1 char(30)) engine = <engine_to_be_used>;
grant INSERT, SELECT on db_drop4.t1 to test_general;
+connection con1_general;
Insert into t1 values ('2nd Insert 3.5.4.4');
Select * from t1;
f1
2nd Insert 3.5.4.4
+connection con1_super;
drop trigger trg4;
ERROR HY000: Trigger does not exist
drop database if exists db_drop4;
@@ -172,17 +188,20 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.4.5:
-----------------
+connection con1_super;
create database db_drop5;
Use db_drop5;
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
grant INSERT, SELECT on t1 to test_general;
Create trigger trg5 BEFORE INSERT on t1
for each row set new.f1='Trigger 3.5.4.5';
+connection con1_general;
Use db_drop5;
Insert into t1 values ('Insert 3.5.4.5');
Select * from t1;
f1
Trigger 3.5.4.5
+connection con1_super;
Drop table t1;
Show tables;
Tables_in_db_drop5
@@ -192,10 +211,12 @@ where information_schema.triggers.trigger_name='trg5';
trigger_schema trigger_name event_object_table
create table t1 (f1 char(50)) engine = <engine_to_be_used>;
grant INSERT, SELECT on t1 to test_general;
+connection con1_general;
Insert into t1 values ('2nd Insert 3.5.4.5');
Select * from t1;
f1
2nd Insert 3.5.4.5
+connection con1_super;
drop trigger trg5;
ERROR HY000: Trigger does not exist
drop database if exists db_drop5;
@@ -203,6 +224,7 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
Testcase 3.5.5:
---------------
+connection default;
use test;
Testcase 3.5.5.1:
@@ -228,6 +250,7 @@ drop view vw3;
Testcase 3.5.5.4:
-----------------
+connection con1_super;
create database dbtest_one;
create database dbtest_two;
use dbtest_two;
@@ -238,6 +261,7 @@ on dbtest_two.t2 for each row set new.f1='trig 3.5.5.4';
ERROR HY000: Trigger in wrong schema
grant INSERT, SELECT on dbtest_two.t2 to test_general;
grant SELECT on dbtest_one.* to test_general;
+connection con1_general;
use dbtest_two;
Insert into t2 values ('1st Insert 3.5.5.4');
Warnings:
@@ -253,12 +277,14 @@ Select * from dbtest_two.t2 order by f1;
f1
1st Insert 3.5.
2nd Insert 3.5.
+connection con1_super;
revoke ALL PRIVILEGES, GRANT OPTION FROM 'test_general'@'localhost';
DROP DATABASE if exists dbtest_one;
drop database if EXISTS dbtest_two;
Testcase 3.5.6:
---------------
+connection default;
use test;
Testcase 3.5.6.1 (see Testcase 3.5.1.1)
@@ -466,6 +492,7 @@ delete from tb3 where f121='Test 3.5.7.15/16';
Testcase 3.5.7.17 (see Testcase 3.5.1.1)
----------------------------------------
+connection default;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_08.result b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
index 4632cfe269c..11bc3b61054 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_08.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_08.result
@@ -69,6 +69,9 @@ revoke ALL PRIVILEGES, GRANT OPTION FROM test_general@localhost;
create User test_super@localhost;
set password for test_super@localhost = password('PWD');
grant ALL on *.* to test_super@localhost with grant OPTION;
+connect con2_general,localhost,test_general,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connect con2_super,localhost,test_super,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
+connection default;
Testcase 3.5.8.1: (implied in previous tests)
---------------------------------------------
@@ -78,6 +81,7 @@ Testcase 3.5.8.2: (implied in previous tests)
Testcase 3.5.8.3/4:
-------------------
+connection con2_super;
create database db_test;
grant SELECT, INSERT, UPDATE, DELETE on db_test.* to test_general;
grant LOCK TABLES on db_test.* to test_general;
@@ -124,6 +128,7 @@ delete from db_test.t1_d where d136= new.f136;
select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u
where u136= new.f136;
END//
+connection con2_general;
Use test;
set @test_var=0;
Insert into tb3 (f120, f122, f136, f144, f163)
@@ -153,11 +158,13 @@ select @test_var;
3.5.8.4 - single SQL - insert
-----------------------------
+connection con2_super;
Create trigger trg2 BEFORE UPDATE on tb3 for each row
BEGIN
insert into db_test.t1_i
values (new.f120, new.f136, new.f144, new.f163);
END//
+connection con2_general;
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
f120 f122 f136 f144 f163
1 Test 3.5.8.4 00222 0000023456 1.050000000000000000000000000000
@@ -176,11 +183,13 @@ I 00222 0000023456 1.050000000000000000000000000000
3.5.8.4 - single SQL - update
-----------------------------
+connection con2_super;
drop trigger trg2;
Create trigger trg3 BEFORE UPDATE on tb3 for each row
update db_test.t1_u
set u120=new.f120
where u136=new.f136;
+connection con2_general;
update tb3 set f120='U', f122='Test 3.5.8.4-Single Update'
where f122='Test 3.5.8.4-Single Insert';
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
@@ -197,9 +206,11 @@ U 00222 0000023456 1.050000000000000000000000000000
3.5.8.3/4 - single SQL - delete
-------------------------------
+connection con2_super;
drop trigger trg3;
Create trigger trg4 AFTER UPDATE on tb3 for each row
delete from db_test.t1_d where d136= new.f136;
+connection con2_general;
update tb3 set f120='D', f136=444,
f122='Test 3.5.8.4-Single Delete'
where f122='Test 3.5.8.4-Single Update';
@@ -213,10 +224,12 @@ c 00333 0000099999 999.990000000000000000000000000000
3.5.8.3/4 - single SQL - select
-------------------------------
+connection con2_super;
drop trigger trg4;
Create trigger trg5 AFTER UPDATE on tb3 for each row
select sum(db_test.t1_u.u163) into @test_var from db_test.t1_u
where u136= new.f136;
+connection con2_general;
set @test_var=0;
update tb3 set f120='S', f136=111,
f122='Test 3.5.8.4-Single Select'
@@ -227,6 +240,7 @@ S Test 3.5.8.4-Single Select 00111 0000023456 1.050000000000000000000000000000
select @test_var;
@test_var
999.990000000000000000000000000000
+connection default;
drop trigger trg1;
drop trigger trg5;
drop database if exists db_test;
@@ -519,6 +533,7 @@ Set @var2=old.f120;
Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
+connection default;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;
diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
index ee7468ff5ba..b937f94d0f3 100644
--- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
+++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
@@ -14,11 +14,13 @@ 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):
+connect con100,localhost,ddicttestuser1,ddictpass,information_schema;
####################################################################################
####################################################################################
2 connection default(user=root with default privileges):
SHOW/SELECT shows all processes/threads.
####################################################################################
+connection default;
SHOW CREATE TABLE processlist;
Table Create Table
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
@@ -95,6 +97,7 @@ ALTER DATABASE information_schema UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
####################################################################################
3 Switch to connection con100 (user=ddicttestuser1 with no PROCESS privilege):
+connection con100;
SHOW/SELECT shows only the processes (1) of the user.
####################################################################################
SHOW CREATE TABLE processlist;
@@ -171,6 +174,7 @@ ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'in
4 Grant PROCESS privilege to ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
####################################################################################
4.1 Existing connection con100 (ddicttestuser1)
@@ -178,6 +182,7 @@ 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.
####################################################################################
+connection con100;
SHOW GRANTS;
Grants for ddicttestuser1@localhost
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
@@ -191,6 +196,7 @@ ID ddicttestuser1 HOST_NAME information_schema Query TIME Filling schema table S
4.2 New connection con101 (ddicttestuser1 with PROCESS privilege)
SHOW/SELECT shows all processes/threads.
####################################################################################
+connect con101,localhost,ddicttestuser1,ddictpass,information_schema;
SHOW GRANTS;
Grants for ddicttestuser1@localhost
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
@@ -208,6 +214,7 @@ ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY R
5 Grant PROCESS privilege to anonymous user.
connection default (user=root)
####################################################################################
+connection default;
create user ''@'localhost';
GRANT PROCESS ON *.* TO ''@'localhost';
####################################################################################
@@ -215,6 +222,7 @@ GRANT PROCESS ON *.* TO ''@'localhost';
anonymous user with PROCESS privilege
SHOW/SELECT shows all processes/threads.
####################################################################################
+connect anonymous1,localhost,"''",,information_schema;
SHOW GRANTS;
Grants for @localhost
GRANT PROCESS ON *.* TO ''@'localhost'
@@ -234,9 +242,11 @@ ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY R
6 Revoke PROCESS privilege from ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
REVOKE PROCESS ON *.* FROM ddicttestuser1@'localhost';
####################################################################################
6.1 New connection con102 (ddicttestuser1 has no more PROCESS privilege)
+connect con102,localhost,ddicttestuser1,ddictpass,information_schema;
Again (compared to state before GRANT PROCESS) only the processes of
ddicttestuser1 are visible.
####################################################################################
@@ -257,9 +267,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
7 Revoke PROCESS privilege from anonymous user
connection default (user=root)
####################################################################################
+connection default;
REVOKE PROCESS ON *.* FROM ''@'localhost';
####################################################################################
7.1 New connection (anonymous2,localhost,'',,information_schema)
+connect anonymous2,localhost,"''",,information_schema;
The anonymous user has no more the PROCESS privilege
Again only the processes of the anonymous user are visible.
####################################################################################
@@ -274,9 +286,11 @@ ID HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS
8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost';
####################################################################################
8.1 New connection con103 (ddicttestuser1 with SUPER privilege)
+connect con103,localhost,ddicttestuser1,ddictpass,information_schema;
Only the processes of ddicttestuser1 user are visible.
####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
@@ -298,9 +312,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
9 Revoke SUPER privilege from user ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
REVOKE SUPER ON *.* FROM 'ddicttestuser1'@'localhost';
####################################################################################
9.1 New connection con104 (ddicttestuser1 without SUPER privilege)
+connect con104,localhost,ddicttestuser1,ddictpass,information_schema;
ddicttestuser1 has no more the SUPER privilege.
Only the processes of ddicttestuser1 are visible.
####################################################################################
@@ -325,9 +341,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
10 Grant SUPER privilege with grant option to user ddicttestuser1.
connection default (user=root)
####################################################################################
+connection default;
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
####################################################################################
10.1 New connection con105 (ddicttestuser1 with SUPER privilege and GRANT OPTION)
+connect con105,localhost,ddicttestuser1,ddictpass,information_schema;
Try to grant PROCESS privilege to user ddicttestuser2 without having it.
####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
@@ -339,9 +357,11 @@ ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password
10.2 Grant SUPER and PROCESS privilege with grant option to user ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
GRANT SUPER,PROCESS ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
####################################################################################
10.3 New connection con106 (ddicttestuser1 with SUPER,PROCESS WITH GRANT OPTION)
+connect con106,localhost,ddicttestuser1,ddictpass,information_schema;
Grant PROCESS privilege to user ddicttestuser2
####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
@@ -350,6 +370,7 @@ GRANT PROCESS, SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWO
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
####################################################################################
10.4 New connection con200 (ddicttestuser2 with PROCESS privilege)
+connect con200,localhost,ddicttestuser2,ddictpass,information_schema;
ddicttestuser2 has now the PROCESS privilege and sees all connections
####################################################################################
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
@@ -385,9 +406,11 @@ ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY R
11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2
connection ddicttestuser1;
####################################################################################
+connection con106;
REVOKE PROCESS ON *.* FROM 'ddicttestuser2'@'localhost';
####################################################################################
11.1 New connection con201 (ddicttestuser2)
+connect con201,localhost,ddicttestuser2,ddictpass,information_schema;
ddicttestuser2 has no more the PROCESS privilege and can only see own connects
####################################################################################
SHOW GRANTS;
@@ -405,9 +428,11 @@ ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
REVOKE SUPER,PROCESS,GRANT OPTION ON *.* FROM 'ddicttestuser1'@'localhost';
####################################################################################
11.3 New connection con107 (ddicttestuser1)
+connect con107,localhost,ddicttestuser1,ddictpass,information_schema;
ddicttestuser1 has no more the PROCESS privilege and can only see own connects
He is also unable to GRANT the PROCESS privilege to ddicttestuser2
####################################################################################
@@ -440,9 +465,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
12 Revoke the SELECT privilege from user ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
REVOKE SELECT ON *.* FROM 'ddicttestuser1'@'localhost';
####################################################################################
12.1 New connection con108 (ddicttestuser1)
+connect con108,localhost,ddicttestuser1,ddictpass,information_schema;
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 ...
@@ -477,12 +504,27 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1.
connection default (user=root)
####################################################################################
+connection default;
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.
####################################################################################
+connection default;
+disconnect con100;
+disconnect con101;
+disconnect con102;
+disconnect con103;
+disconnect con104;
+disconnect con105;
+disconnect con106;
+disconnect con107;
+disconnect con108;
+disconnect con200;
+disconnect con201;
+disconnect anonymous1;
+disconnect anonymous2;
DROP USER ddicttestuser1@'localhost';
DROP USER ddicttestuser2@'localhost';
REVOKE USAGE ON *.* FROM ''@'localhost';
diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
index c3c6780a09c..e312b1c60ef 100644
--- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
+++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
@@ -14,11 +14,13 @@ 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):
+connect con100,localhost,ddicttestuser1,ddictpass,information_schema;
####################################################################################
####################################################################################
2 connection default(user=root with default privileges):
SHOW/SELECT shows all processes/threads.
####################################################################################
+connection default;
SHOW CREATE TABLE processlist;
Table Create Table
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
@@ -95,6 +97,7 @@ ALTER DATABASE information_schema UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
####################################################################################
3 Switch to connection con100 (user=ddicttestuser1 with no PROCESS privilege):
+connection con100;
SHOW/SELECT shows only the processes (1) of the user.
####################################################################################
SHOW CREATE TABLE processlist;
@@ -171,6 +174,7 @@ ERROR 42000: Access denied for user 'ddicttestuser1'@'localhost' to database 'in
4 Grant PROCESS privilege to ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass';
####################################################################################
4.1 Existing connection con100 (ddicttestuser1)
@@ -178,6 +182,7 @@ 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.
####################################################################################
+connection con100;
SHOW GRANTS;
Grants for ddicttestuser1@localhost
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
@@ -191,6 +196,7 @@ ID ddicttestuser1 HOST_NAME information_schema Execute TIME Filling schema table
4.2 New connection con101 (ddicttestuser1 with PROCESS privilege)
SHOW/SELECT shows all processes/threads.
####################################################################################
+connect con101,localhost,ddicttestuser1,ddictpass,information_schema;
SHOW GRANTS;
Grants for ddicttestuser1@localhost
GRANT PROCESS ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWORD '*22DA61451703738F203CDB9DB041ACBA1F4760B1'
@@ -208,6 +214,7 @@ ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY R
5 Grant PROCESS privilege to anonymous user.
connection default (user=root)
####################################################################################
+connection default;
create user ''@'localhost';
GRANT PROCESS ON *.* TO ''@'localhost';
####################################################################################
@@ -215,6 +222,7 @@ GRANT PROCESS ON *.* TO ''@'localhost';
anonymous user with PROCESS privilege
SHOW/SELECT shows all processes/threads.
####################################################################################
+connect anonymous1,localhost,"''",,information_schema;
SHOW GRANTS;
Grants for @localhost
GRANT PROCESS ON *.* TO ''@'localhost'
@@ -234,9 +242,11 @@ ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY R
6 Revoke PROCESS privilege from ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
REVOKE PROCESS ON *.* FROM ddicttestuser1@'localhost';
####################################################################################
6.1 New connection con102 (ddicttestuser1 has no more PROCESS privilege)
+connect con102,localhost,ddicttestuser1,ddictpass,information_schema;
Again (compared to state before GRANT PROCESS) only the processes of
ddicttestuser1 are visible.
####################################################################################
@@ -257,9 +267,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
7 Revoke PROCESS privilege from anonymous user
connection default (user=root)
####################################################################################
+connection default;
REVOKE PROCESS ON *.* FROM ''@'localhost';
####################################################################################
7.1 New connection (anonymous2,localhost,'',,information_schema)
+connect anonymous2,localhost,"''",,information_schema;
The anonymous user has no more the PROCESS privilege
Again only the processes of the anonymous user are visible.
####################################################################################
@@ -274,9 +286,11 @@ ID HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY ROWS
8 Grant SUPER (does not imply PROCESS) privilege to ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost';
####################################################################################
8.1 New connection con103 (ddicttestuser1 with SUPER privilege)
+connect con103,localhost,ddicttestuser1,ddictpass,information_schema;
Only the processes of ddicttestuser1 user are visible.
####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
@@ -298,9 +312,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
9 Revoke SUPER privilege from user ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
REVOKE SUPER ON *.* FROM 'ddicttestuser1'@'localhost';
####################################################################################
9.1 New connection con104 (ddicttestuser1 without SUPER privilege)
+connect con104,localhost,ddicttestuser1,ddictpass,information_schema;
ddicttestuser1 has no more the SUPER privilege.
Only the processes of ddicttestuser1 are visible.
####################################################################################
@@ -325,9 +341,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
10 Grant SUPER privilege with grant option to user ddicttestuser1.
connection default (user=root)
####################################################################################
+connection default;
GRANT SUPER ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
####################################################################################
10.1 New connection con105 (ddicttestuser1 with SUPER privilege and GRANT OPTION)
+connect con105,localhost,ddicttestuser1,ddictpass,information_schema;
Try to grant PROCESS privilege to user ddicttestuser2 without having it.
####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
@@ -339,9 +357,11 @@ ERROR 28000: Access denied for user 'ddicttestuser1'@'localhost' (using password
10.2 Grant SUPER and PROCESS privilege with grant option to user ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
GRANT SUPER,PROCESS ON *.* TO 'ddicttestuser1'@'localhost' WITH GRANT OPTION;
####################################################################################
10.3 New connection con106 (ddicttestuser1 with SUPER,PROCESS WITH GRANT OPTION)
+connect con106,localhost,ddicttestuser1,ddictpass,information_schema;
Grant PROCESS privilege to user ddicttestuser2
####################################################################################
SHOW GRANTS FOR 'ddicttestuser1'@'localhost';
@@ -350,6 +370,7 @@ GRANT PROCESS, SUPER ON *.* TO 'ddicttestuser1'@'localhost' IDENTIFIED BY PASSWO
GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost';
####################################################################################
10.4 New connection con200 (ddicttestuser2 with PROCESS privilege)
+connect con200,localhost,ddicttestuser2,ddictpass,information_schema;
ddicttestuser2 has now the PROCESS privilege and sees all connections
####################################################################################
SHOW GRANTS FOR 'ddicttestuser2'@'localhost';
@@ -385,9 +406,11 @@ ID root HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.000 MEMORY R
11 User ddicttestuser1 revokes PROCESS privilege from user ddicttestuser2
connection ddicttestuser1;
####################################################################################
+connection con106;
REVOKE PROCESS ON *.* FROM 'ddicttestuser2'@'localhost';
####################################################################################
11.1 New connection con201 (ddicttestuser2)
+connect con201,localhost,ddicttestuser2,ddictpass,information_schema;
ddicttestuser2 has no more the PROCESS privilege and can only see own connects
####################################################################################
SHOW GRANTS;
@@ -405,9 +428,11 @@ ID ddicttestuser2 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
11.2 Revoke SUPER,PROCESS,GRANT OPTION privilege from user ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
REVOKE SUPER,PROCESS,GRANT OPTION ON *.* FROM 'ddicttestuser1'@'localhost';
####################################################################################
11.3 New connection con107 (ddicttestuser1)
+connect con107,localhost,ddicttestuser1,ddictpass,information_schema;
ddicttestuser1 has no more the PROCESS privilege and can only see own connects
He is also unable to GRANT the PROCESS privilege to ddicttestuser2
####################################################################################
@@ -440,9 +465,11 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
12 Revoke the SELECT privilege from user ddicttestuser1
connection default (user=root)
####################################################################################
+connection default;
REVOKE SELECT ON *.* FROM 'ddicttestuser1'@'localhost';
####################################################################################
12.1 New connection con108 (ddicttestuser1)
+connect con108,localhost,ddicttestuser1,ddictpass,information_schema;
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 ...
@@ -477,12 +504,27 @@ ID ddicttestuser1 HOST_NAME information_schema Sleep TIME NULL TIME_MS 0 0 0.00
12.2 Revoke only the SELECT privilege on the information_schema from ddicttestuser1.
connection default (user=root)
####################################################################################
+connection default;
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.
####################################################################################
+connection default;
+disconnect con100;
+disconnect con101;
+disconnect con102;
+disconnect con103;
+disconnect con104;
+disconnect con105;
+disconnect con106;
+disconnect con107;
+disconnect con108;
+disconnect con200;
+disconnect con201;
+disconnect anonymous1;
+disconnect anonymous2;
DROP USER ddicttestuser1@'localhost';
DROP USER ddicttestuser2@'localhost';
REVOKE USAGE ON *.* FROM ''@'localhost';
diff --git a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
index acf81d090d1..170ba0c2efb 100644
--- a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
+++ b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
@@ -74,10 +74,8 @@ Has TIME a reasonable value?
# Ensure that the information about an inactive connection is correct.
#--------------------------------------------------------------------------
-# ----- establish connection con1 (user = test_user) -----
-
-# ----- switch to connection default (user = root) -----
-
+connect con1,localhost,test_user,ddictpass,information_schema;
+connection default;
# Poll till the connection con1 is in state COMMAND = 'Sleep'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
@@ -112,8 +110,7 @@ Expect 1
# because he has not the PROCESS privilege.
#----------------------------------------------------------------------------
-# ----- switch to connection con1 (user = test_user) -----
-
+connection con1;
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
<ID> test_user <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
@@ -123,14 +120,11 @@ Id User Host db Command Time State Info Progress
# Ensure that the user test_user sees all connections with his username.
#----------------------------------------------------------------------------
------ establish connection con2 (user = test_user) ------
-
-# ----- switch to connection default (user = root) -----
-
+connect con2,localhost,test_user,ddictpass,information_schema;
+connection default;
# Poll till all connections of 'test_user' are in a state with COMMAND = 'Sleep'
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
<ID> test_user <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
@@ -139,22 +133,19 @@ SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Progress
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL 0.000
<ID> test_user <HOST_NAME> information_schema Query <TIME> init SHOW FULL PROCESSLIST 0.000
-# ----- switch to connection default (user = root) -----
-
+connection default;
SELECT ID INTO @test_user_con2_id FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID <> @test_user_con1_id
AND USER = 'test_user' AND DB = 'information_schema';
# Ensure we get correct information about a connection during work
#----------------------------------------------------------------------------
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Send a long enough running statement to the server, but do not
# wait till the result comes back.
SELECT sleep(10), 17;
-# ----- switch to connection default (user = root) -----
-
+connection default;
# Poll till connection con2 is in state 'User sleep'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
@@ -179,14 +170,12 @@ Has STATE the expected value?
SELECT @info = 'SELECT sleep(10), 17' AS "Has INFO the expected value?";
Has INFO the expected value?
1
-# ----- switch to connection con2 (user = testuser) -----
-
+connection con2;
# Pull("reap") the result set from the statement executed with "send".
sleep(10) 17
0 17
-# ----- switch to connection default (user = root) -----
-
+connection default;
# Poll till all connections of 'test_user' are in a state with COMMAND = 'Sleep'
# Ensure that we see that a connection "hangs" when colliding with a
@@ -194,14 +183,12 @@ sleep(10) 17
#----------------------------------------------------------------------------
LOCK TABLE test.t1 WRITE;
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Send a statement to the server, but do not wait till the result
# comes back. We will pull this later.
SELECT COUNT(*) FROM test.t1;
-# ----- switch to connection default (user = root) -----
-
+connection default;
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
@@ -210,8 +197,7 @@ ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL <TID>
<ID> root <HOST_NAME> information_schema Query <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
UNLOCK TABLES;
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Pull("reap") the result set from the statement executed with "send".
COUNT(*)
@@ -219,17 +205,14 @@ COUNT(*)
# Ensure that SHOW/SELECT processlist can handle extreme long commands
#----------------------------------------------------------------------------
-# ----- switch to connection default (user = root) -----
-
+connection default;
LOCK TABLE test.t1 WRITE;
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Send a long (~20 KB code) statement to the server, but do not wait
# till the result comes back. We will pull this later.
SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1;
-# ----- switch to connection default (user = root) -----
-
+connection default;
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
# Expect result:
@@ -254,15 +237,13 @@ Id User Host db Command Time State Info Progress
<ID> test_user <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> NULL 0.000
<ID> test_user <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representativ 0.000
UNLOCK TABLES;
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Pull("reap") the result set from the monster statement executed with "send".
count(*) Long string
0 BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END
-# ----- switch to connection default (user = root) -----
-
------ disconnect con1 and con2 -----
-
+connection default;
+disconnect con1;
+disconnect con2;
DROP USER test_user@'localhost';
DROP TABLE test.t1;
diff --git a/mysql-test/suite/funcs_1/r/processlist_val_ps.result b/mysql-test/suite/funcs_1/r/processlist_val_ps.result
index 8e5ef80fcf7..5914c8e7844 100644
--- a/mysql-test/suite/funcs_1/r/processlist_val_ps.result
+++ b/mysql-test/suite/funcs_1/r/processlist_val_ps.result
@@ -74,10 +74,8 @@ Has TIME a reasonable value?
# Ensure that the information about an inactive connection is correct.
#--------------------------------------------------------------------------
-# ----- establish connection con1 (user = test_user) -----
-
-# ----- switch to connection default (user = root) -----
-
+connect con1,localhost,test_user,ddictpass,information_schema;
+connection default;
# Poll till the connection con1 is in state COMMAND = 'Sleep'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
@@ -112,8 +110,7 @@ Expect 1
# because he has not the PROCESS privilege.
#----------------------------------------------------------------------------
-# ----- switch to connection con1 (user = test_user) -----
-
+connection con1;
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
<ID> test_user <HOST_NAME> information_schema Execute <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
@@ -123,14 +120,11 @@ Id User Host db Command Time State Info Progress
# Ensure that the user test_user sees all connections with his username.
#----------------------------------------------------------------------------
------ establish connection con2 (user = test_user) ------
-
-# ----- switch to connection default (user = root) -----
-
+connect con2,localhost,test_user,ddictpass,information_schema;
+connection default;
# Poll till all connections of 'test_user' are in a state with COMMAND = 'Sleep'
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_USED EXAMINED_ROWS QUERY_ID INFO_BINARY TID
<ID> test_user <HOST_NAME> information_schema Execute <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
@@ -139,22 +133,19 @@ SHOW FULL PROCESSLIST;
Id User Host db Command Time State Info Progress
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL 0.000
<ID> test_user <HOST_NAME> information_schema Query <TIME> init SHOW FULL PROCESSLIST 0.000
-# ----- switch to connection default (user = root) -----
-
+connection default;
SELECT ID INTO @test_user_con2_id FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE ID <> @test_user_con1_id
AND USER = 'test_user' AND DB = 'information_schema';
# Ensure we get correct information about a connection during work
#----------------------------------------------------------------------------
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Send a long enough running statement to the server, but do not
# wait till the result comes back.
SELECT sleep(10), 17;
-# ----- switch to connection default (user = root) -----
-
+connection default;
# Poll till connection con2 is in state 'User sleep'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
@@ -179,14 +170,12 @@ Has STATE the expected value?
SELECT @info = 'SELECT sleep(10), 17' AS "Has INFO the expected value?";
Has INFO the expected value?
1
-# ----- switch to connection con2 (user = testuser) -----
-
+connection con2;
# Pull("reap") the result set from the statement executed with "send".
sleep(10) 17
0 17
-# ----- switch to connection default (user = root) -----
-
+connection default;
# Poll till all connections of 'test_user' are in a state with COMMAND = 'Sleep'
# Ensure that we see that a connection "hangs" when colliding with a
@@ -194,14 +183,12 @@ sleep(10) 17
#----------------------------------------------------------------------------
LOCK TABLE test.t1 WRITE;
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Send a statement to the server, but do not wait till the result
# comes back. We will pull this later.
SELECT COUNT(*) FROM test.t1;
-# ----- switch to connection default (user = root) -----
-
+connection default;
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST;
@@ -210,8 +197,7 @@ ID USER HOST DB COMMAND TIME STATE INFO TIME_MS STAGE MAX_STAGE PROGRESS MEMORY_
<ID> test_user <HOST_NAME> information_schema Sleep <TIME> NULL <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> NULL <TID>
<ID> root <HOST_NAME> information_schema Execute <TIME> Filling schema table SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TIME_MS> 0 0 0.000 <MEMORY> <ROWS> <QUERY_ID> SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST <TID>
UNLOCK TABLES;
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Pull("reap") the result set from the statement executed with "send".
COUNT(*)
@@ -219,17 +205,14 @@ COUNT(*)
# Ensure that SHOW/SELECT processlist can handle extreme long commands
#----------------------------------------------------------------------------
-# ----- switch to connection default (user = root) -----
-
+connection default;
LOCK TABLE test.t1 WRITE;
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Send a long (~20 KB code) statement to the server, but do not wait
# till the result comes back. We will pull this later.
SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END' AS "Long string" FROM test.t1;
-# ----- switch to connection default (user = root) -----
-
+connection default;
# Poll till INFO is no more NULL and State = 'Waiting for table metadata lock'.
# Expect result:
@@ -254,15 +237,13 @@ Id User Host db Command Time State Info Progress
<ID> test_user <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> NULL 0.000
<ID> test_user <HOST_NAME> information_schema <COMMAND> <TIME> <STATE> SELECT count(*),'BEGIN-This is the representative of a very long statement.This is the representativ 0.000
UNLOCK TABLES;
-# ----- switch to connection con2 (user = test_user) -----
-
+connection con2;
# Pull("reap") the result set from the monster statement executed with "send".
count(*) Long string
0 BEGIN-This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.This is the representative of a very long statement.-END
-# ----- switch to connection default (user = root) -----
-
------ disconnect con1 and con2 -----
-
+connection default;
+disconnect con1;
+disconnect con2;
DROP USER test_user@'localhost';
DROP TABLE test.t1;
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 655a5d3ff96..b995fa730c0 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -1832,9 +1832,11 @@ CREATE PROCEDURE sp11() insert into mysql.t1 values('a');
SELECT security_type from mysql.proc where specific_name='sp11';
security_type
DEFINER
+connect u_1, localhost, user_1, , db_storedproc;
user_1@localhost db_storedproc
CALL sp11();
+connection default;
USE db_storedproc;
root@localhost db_storedproc
@@ -1842,12 +1844,15 @@ alter procedure sp11 sql security invoker;
SELECT security_type from mysql.proc where specific_name='sp11';
security_type
INVOKER
+connection u_1;
user_1@localhost db_storedproc
USE db_storedproc;
CALL sp11();
ERROR 42000: INSERT command denied to user 'user_1'@'localhost' for table 't1'
commit work;
+disconnect u_1;
+connection default;
root@localhost db_storedproc
alter procedure sp11 sql security DEFINER;
diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc
index 8382bcc1e55..930322e203a 100644
--- a/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc
+++ b/mysql-test/suite/funcs_1/storedproc/storedproc_10.inc
@@ -88,7 +88,6 @@ CALL sp31102();
SELECT fn31105( 9 );
# now 'add' EXECUTE to INVOKER
---echo connection default;
connection default;
USE db_storedproc;
--source suite/funcs_1/include/show_connection.inc
@@ -107,7 +106,6 @@ SELECT fn31105( 9 );
disconnect user2_3;
# now 'remove' SELECT from INVOKER
---echo connection default;
connection default;
USE db_storedproc;
--source suite/funcs_1/include/show_connection.inc
diff --git a/mysql-test/suite/funcs_1/t/charset_collation.test b/mysql-test/suite/funcs_1/t/charset_collation.test
index 186eb1f5b85..44199c60251 100644
--- a/mysql-test/suite/funcs_1/t/charset_collation.test
+++ b/mysql-test/suite/funcs_1/t/charset_collation.test
@@ -18,7 +18,6 @@
DROP USER dbdict_test@localhost;
CREATE USER dbdict_test@localhost;
---echo # Establish connection con (user=dbdict_test)
connect (con,localhost,dbdict_test,,);
################################################################################
#
@@ -100,8 +99,6 @@ ORDER BY collation_name, character_set_name;
# Cleanup
---echo # Switch to connection default + disconnect con
connection default;
disconnect con;
DROP USER dbdict_test@localhost;
-
diff --git a/mysql-test/suite/funcs_1/t/is_basics_mixed.test b/mysql-test/suite/funcs_1/t/is_basics_mixed.test
index 21efafb5afa..c0b03a84478 100644
--- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test
+++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test
@@ -43,7 +43,6 @@ SHOW DATABASES LIKE 'information_schema';
#
# Note: The "for query purposes only" is checked in other tests.
# High privileged user (root)
---echo # Switch to connection default
connection default;
USE test;
SELECT DATABASE();
@@ -54,14 +53,12 @@ SELECT DATABASE();
DROP USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
# Low privileged user
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , test);
SELECT DATABASE();
USE information_schema;
SELECT DATABASE();
#
---echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
@@ -89,7 +86,6 @@ CREATE DATABASE information_schema;
#
# 1. High privileged user (root)
---echo # Switch to connection default (user=root)
connection default;
--source suite/funcs_1/datadict/basics_mixed1.inc
@@ -99,12 +95,10 @@ DROP USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
GRANT ALL ON *.* TO testuser1@localhost;
SHOW GRANTS FOR testuser1@localhost;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , test);
--source suite/funcs_1/datadict/basics_mixed1.inc
---echo # Switch to connection default (user=root) and close connection testuser1
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
@@ -270,7 +264,6 @@ GRANT CREATE VIEW ON information_schema.* TO 'u_6_401018'@'localhost';
# Check 1: Show that a "simple" user (<> root) has the permission to SELECT
# on some INFORMATION_SCHEMA table.
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
SELECT table_schema,table_name FROM information_schema.tables
@@ -298,7 +291,6 @@ SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM information_schema.tables WHERE table_schema = 'db_datadict';
GRANT SELECT ON db_datadict.v2 to testuser2@localhost;
#
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
@@ -307,7 +299,6 @@ SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM information_schema.tables WHERE table_schema = 'db_datadict';
# Cleanup
---echo # Switch to connection default and close connections testuser1 and testuser2
connection default;
disconnect testuser1;
disconnect testuser2;
@@ -445,13 +436,11 @@ DROP USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
GRANT ALL ON test.* TO 'testuser1'@'localhost';
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , test);
--source suite/funcs_1/datadict/basics_mixed3.inc
# Cleanup
---echo # Switch to connection default and close connections testuser1 and testuser2
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
diff --git a/mysql-test/suite/funcs_1/t/is_column_privileges.test b/mysql-test/suite/funcs_1/t/is_column_privileges.test
index cb8c50c01b7..7c0d7c7c063 100644
--- a/mysql-test/suite/funcs_1/t/is_column_privileges.test
+++ b/mysql-test/suite/funcs_1/t/is_column_privileges.test
@@ -131,17 +131,14 @@ WITH GRANT OPTION;
eval $select;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
eval $select;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
eval $select;
---echo # Establish connection testuser3 (user=testuser3)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser3, localhost, testuser3, , db_datadict);
@@ -158,12 +155,10 @@ GRANT SELECT(f1, f3) ON db_datadict.t1 TO 'testuser2'@'localhost';
--echo # FIXME: Is it intended that *my* grants to others are *NOT* shown here?
eval $select;
---echo # Switch to connection testuser2 (user=testuser2)
connection testuser2;
eval $select;
# Cleanup
---echo # Switch to connection default and close connections testuser1,testuser2,testuser3
connection default;
disconnect testuser1;
disconnect testuser2;
@@ -214,71 +209,59 @@ let $my_show = SHOW GRANTS FOR 'testuser1'@'localhost';
eval $my_select;
eval $my_show;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , test);
eval $my_select;
eval $my_show;
---echo # Switch to connection default
connection default;
GRANT SELECT (f1,f3) ON db_datadict.my_table TO 'testuser1'@'localhost';
eval $my_select;
eval $my_show;
---echo # Switch to connection testuser1
connection testuser1;
eval $my_select;
eval $my_show;
---echo # Switch to connection default
connection default;
ALTER TABLE db_datadict.my_table DROP COLUMN f3;
GRANT UPDATE (f1) ON db_datadict.my_table TO 'testuser1'@'localhost';
eval $my_select;
eval $my_show;
---echo # Switch to connection testuser1
connection testuser1;
eval $my_select;
eval $my_show;
--error ER_BAD_FIELD_ERROR
SELECT f1, f3 FROM db_datadict.my_table;
---echo # Switch to connection default
connection default;
ALTER TABLE db_datadict.my_table CHANGE COLUMN f1 my_col BIGINT;
eval $my_select;
eval $my_show;
---echo # Switch to connection testuser1
connection testuser1;
eval $my_select;
eval $my_show;
---echo # Switch to connection default
connection default;
DROP TABLE db_datadict.my_table;
eval $my_select;
eval $my_show;
---echo # Switch to connection testuser1
connection testuser1;
eval $my_select;
eval $my_show;
---echo # Switch to connection default
connection default;
REVOKE ALL ON db_datadict.my_table FROM 'testuser1'@'localhost';
eval $my_select;
eval $my_show;
---echo # Switch to connection testuser1
connection testuser1;
eval $my_select;
eval $my_show;
---echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
diff --git a/mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test b/mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test
index 33269fe929c..200ee66e2a1 100644
--- a/mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test
+++ b/mysql-test/suite/funcs_1/t/is_column_privileges_is_mysql_test.test
@@ -45,7 +45,6 @@ eval $my_show1;
eval $my_show2;
eval $my_show3;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
eval $my_select;
@@ -54,7 +53,6 @@ eval $my_show2;
eval $my_show3;
# Cleanup
---echo # Switch to connection default and close connection testuser1
connection default;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
diff --git a/mysql-test/suite/funcs_1/t/is_columns.test b/mysql-test/suite/funcs_1/t/is_columns.test
index c5fe18fef20..5fb72713742 100644
--- a/mysql-test/suite/funcs_1/t/is_columns.test
+++ b/mysql-test/suite/funcs_1/t/is_columns.test
@@ -148,7 +148,6 @@ eval $my_show1;
eval $my_show2;
eval $my_show3;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
--source suite/funcs_1/datadict/datadict_bug_12777.inc
@@ -158,7 +157,6 @@ eval $my_show1;
eval $my_show2;
eval $my_show3;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
--source suite/funcs_1/datadict/datadict_bug_12777.inc
@@ -169,7 +167,6 @@ eval $my_show2;
--error ER_TABLEACCESS_DENIED_ERROR
eval $my_show3;
---echo # Switch to connection default and close connections testuser1, testuser2
connection default;
disconnect testuser1;
disconnect testuser2;
diff --git a/mysql-test/suite/funcs_1/t/is_schema_privileges.test b/mysql-test/suite/funcs_1/t/is_schema_privileges.test
index 1f408d71b39..fdf09a6f94b 100644
--- a/mysql-test/suite/funcs_1/t/is_schema_privileges.test
+++ b/mysql-test/suite/funcs_1/t/is_schema_privileges.test
@@ -115,7 +115,6 @@ ORDER BY grantee,table_schema,privilege_type;
let $show_testuser1 = SHOW GRANTS FOR 'testuser1'@'localhost';
let $show_testuser2 = SHOW GRANTS FOR 'testuser2'@'localhost';
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , test);
GRANT SELECT ON db_datadict_4.* TO 'testuser2'@'localhost';
@@ -132,7 +131,6 @@ eval $show_testuser1;
--error ER_DBACCESS_DENIED_ERROR
eval $show_testuser2;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , test);
--echo # Root granted SELECT db_datadict_1 to me -> visible
@@ -145,7 +143,6 @@ eval $my_select;
eval $show_testuser1;
eval $show_testuser2;
---echo # Switch to connection default and close connections testuser1 and testuser2
connection default;
disconnect testuser1;
disconnect testuser2;
@@ -197,73 +194,55 @@ ORDER BY grantee,table_schema,privilege_type;
############ Check grant SCHEMA
eval $my_select;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , test);
eval $my_select;
---echo # Switch to connection default
connection default;
GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost';
eval $my_select;
---echo # Switch to connection testuser1
eval $my_select;
############ Check RENAME SCHEMA
# Implement this if RENAME SCHEMA is again available.
# Note(mleich): I expect that RENAME has no impact on the result sets, because
# the schema_name is not migrated.
-# --echo # Switch to connection default
# connection default;
# RENAME SCHEMA db_datadict TO db_datadictx;
# eval $my_select;
-# --echo # Switch to connection testuser1
# eval $my_select;
# RENAME SCHEMA db_datadictx TO db_datadict;
############ Check extend PRIVILEGES (affects PRIVILEGE_TYPE) on SCHEMA
---echo # Switch to connection default
connection default;
GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost';
eval $my_select;
---echo # Switch to connection testuser1
eval $my_select;
############ Check extend PRIVILEGES (affects IS_GRANTABLE) on SCHEMA
--echo # Switch to connection default
connection default;
GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
eval $my_select;
---echo # Switch to connection testuser1
eval $my_select;
############ Check DROP SCHEMA
# No impact, because there is no "maintenance" of privileges.
---echo # Switch to connection default
connection default;
DROP SCHEMA db_datadict;
eval $my_select;
---echo # Switch to connection testuser1
eval $my_select;
############ Check REVOKE PRIVILEGE
---echo # Switch to connection default
connection default;
REVOKE UPDATE ON db_datadict.* FROM 'testuser1'@'localhost';
eval $my_select;
---echo # Switch to connection testuser1
eval $my_select;
############ Check RENAME USER
---echo # Switch to connection default
connection default;
RENAME USER 'testuser1'@'localhost' TO 'the_user'@'localhost';
eval $my_select;
---echo # Switch to connection testuser1
eval $my_select;
---echo # Close connection testuser1
disconnect testuser1;
---echo # Establish connection the_user (user=the_user)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (the_user, localhost, the_user, , test);
eval $my_select;
---echo # Close connection the_user
disconnect the_user;
############ Check DROP USER
---echo # Switch to connection default
connection default;
eval $my_select;
DROP USER 'the_user'@'localhost';
diff --git a/mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test b/mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test
index 3f60f71fe9a..f1e0d571057 100644
--- a/mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test
+++ b/mysql-test/suite/funcs_1/t/is_schema_privileges_is_mysql_test.test
@@ -45,7 +45,6 @@ eval $my_show1;
eval $my_show2;
eval $my_show3;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
eval $my_select;
@@ -54,8 +53,6 @@ eval $my_show2;
eval $my_show3;
# Cleanup
---echo # Switch to connection default and close connection testuser1
connection default;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
-
diff --git a/mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test b/mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test
index 9bfbf0cf335..6b515bc596a 100644
--- a/mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test
+++ b/mysql-test/suite/funcs_1/t/is_schemata_is_mysql_test.test
@@ -45,7 +45,6 @@ eval $my_show1;
eval $my_show2;
eval $my_show3;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
eval $my_select;
@@ -54,8 +53,6 @@ eval $my_show2;
eval $my_show3;
# Cleanup
---echo # Switch to connection default and close connection testuser1
connection default;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
-
diff --git a/mysql-test/suite/funcs_1/t/is_statistics.test b/mysql-test/suite/funcs_1/t/is_statistics.test
index 458892a6d91..3cdc5568960 100644
--- a/mysql-test/suite/funcs_1/t/is_statistics.test
+++ b/mysql-test/suite/funcs_1/t/is_statistics.test
@@ -139,7 +139,6 @@ eval $my_select;
eval $my_show1;
eval $my_show2;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , test);
# nothing visible for testuser1
@@ -148,7 +147,6 @@ eval $my_show1;
--error ER_DBACCESS_DENIED_ERROR
eval $my_show2;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , test);
# nothing visible for testuser2
@@ -157,7 +155,6 @@ eval $my_select;
eval $my_show1;
eval $my_show2;
---echo # Switch to connection default
connection default;
GRANT SELECT ON db_datadict.t1 TO 'testuser1'@'localhost' WITH GRANT OPTION;
GRANT SELECT(f1,f5) ON db_datadict_2.t3 TO 'testuser1'@'localhost';
@@ -165,33 +162,28 @@ eval $my_select;
eval $my_show1;
eval $my_show2;
---echo # Switch to connection testuser1
connection testuser1;
eval $my_select;
eval $my_show1;
--error ER_DBACCESS_DENIED_ERROR
eval $my_show2;
---echo # Switch to connection testuser2
connection testuser2;
eval $my_select;
--error ER_DBACCESS_DENIED_ERROR
eval $my_show1;
eval $my_show2;
---echo # Switch to connection default
connection default;
REVOKE SELECT,GRANT OPTION ON db_datadict.t1 FROM 'testuser1'@'localhost';
eval $my_show1;
---echo # Switch to connection testuser1
# nothing visible for testuser1
connection testuser1;
eval $my_select;
eval $my_show1;
# Cleanup
---echo # Switch to connection default and close connections testuser1, testuser2
connection default;
disconnect testuser1;
disconnect testuser2;
diff --git a/mysql-test/suite/funcs_1/t/is_table_constraints.test b/mysql-test/suite/funcs_1/t/is_table_constraints.test
index 79766fc1dff..d1659517e79 100644
--- a/mysql-test/suite/funcs_1/t/is_table_constraints.test
+++ b/mysql-test/suite/funcs_1/t/is_table_constraints.test
@@ -132,7 +132,6 @@ eval $my_show1;
--replace_column 6 ### 7 ### 8 ### 9 ### 10 ### 11 ### 12 ###
eval $my_show2;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
SHOW GRANTS FOR 'testuser1'@'localhost';
@@ -143,7 +142,6 @@ eval $my_show1;
eval $my_show2;
# Cleanup
---echo # Switch to connection default and close connection testuser1
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
diff --git a/mysql-test/suite/funcs_1/t/is_table_privileges.test b/mysql-test/suite/funcs_1/t/is_table_privileges.test
index 5ea0dd7c6a7..df28f2caaef 100644
--- a/mysql-test/suite/funcs_1/t/is_table_privileges.test
+++ b/mysql-test/suite/funcs_1/t/is_table_privileges.test
@@ -115,7 +115,6 @@ let $my_select = SELECT * FROM information_schema.table_privileges
WHERE table_name LIKE 'tb%'
ORDER BY grantee,table_schema,table_name,privilege_type;
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
--replace_result $other_engine_type <other_engine_type>
@@ -126,21 +125,18 @@ GRANT SELECT ON db_datadict.tb3 TO 'testuser3'@'localhost';
eval $my_select;
SHOW GRANTS FOR 'testuser1'@'localhost';
---echo # Establish connection testuser2 (user=testuser3)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
# we see only table privileges for this user, and not any other privileges
eval $my_select;
SHOW GRANTS FOR 'testuser2'@'localhost';
---echo # Establish connection testuser3 (user=testuser3)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser3, localhost, testuser3, , db_datadict);
# we see only table privileges for this user, and not any other privileges
eval $my_select;
SHOW GRANTS FOR 'testuser3'@'localhost';
---echo # Switch to connection default and close the other connections
connection default;
disconnect testuser1;
disconnect testuser2;
diff --git a/mysql-test/suite/funcs_1/t/is_user_privileges.test b/mysql-test/suite/funcs_1/t/is_user_privileges.test
index 0f0e398d75b..a61e9187d15 100644
--- a/mysql-test/suite/funcs_1/t/is_user_privileges.test
+++ b/mysql-test/suite/funcs_1/t/is_user_privileges.test
@@ -117,7 +117,6 @@ eval $my_select1;
eval $my_select2;
--horizontal_results
---echo # Establish connection testuser1 (user=testuser1)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser1, localhost, testuser1, , db_datadict);
--vertical_results
@@ -129,7 +128,6 @@ eval $my_show;
--echo
--echo # Now add SELECT on *.* to testuser1;
---echo # Switch to connection default
connection default;
GRANT SELECT ON *.* TO 'testuser1'@'localhost';
--echo #
@@ -147,7 +145,6 @@ eval $my_select1;
eval $my_select2;
--horizontal_results
---echo # Switch to connection testuser1
# check that this appears
connection testuser1;
--vertical_results
@@ -156,7 +153,6 @@ eval $my_select2;
--horizontal_results
eval $my_show;
---echo # Establish connection testuser2 (user=testuser2)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser2, localhost, testuser2, , db_datadict);
--vertical_results
@@ -166,7 +162,6 @@ eval $my_select2;
--horizontal_results
eval $my_show;
---echo # Establish connection testuser3 (user=testuser3)
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
connect (testuser3, localhost, testuser3, , test);
--vertical_results
@@ -178,7 +173,6 @@ eval $my_show;
--echo
--echo # Revoke privileges from testuser1;
---echo # Switch to connection default
connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'testuser1'@'localhost';
--vertical_results
@@ -186,7 +180,6 @@ eval $my_select1;
eval $my_select2;
--horizontal_results
---echo # Switch to connection testuser1
# check for changes
connection testuser1;
--vertical_results
@@ -211,7 +204,6 @@ CREATE TABLE db_datadict.tb_66 ( c1 TEXT );
--echo
--echo # Add ALL on db_datadict.* (and select on mysql.user) to testuser1;
---echo # Switch to connection default
connection default;
GRANT ALL ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
GRANT SELECT ON mysql.user TO 'testuser1'@'localhost';
@@ -220,7 +212,6 @@ eval $my_select1;
eval $my_select2;
--horizontal_results
---echo # Switch to connection testuser1
connection testuser1;
--vertical_results
eval $my_select1;
@@ -246,7 +237,6 @@ ENGINE = $other_engine_type;
--echo
--echo # Revoke privileges from testuser1;
---echo # Switch to connection default
connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'testuser1'@'localhost';
--vertical_results
@@ -254,7 +244,6 @@ eval $my_select1;
eval $my_select2;
--horizontal_results
---echo # Switch to connection testuser1
# check for changes
connection testuser1;
--vertical_results
@@ -278,7 +267,6 @@ CREATE TABLE db_datadict.tb_59 ( c1 TEXT )
ENGINE = $other_engine_type;
# Cleanup
---echo # Switch to connection default and close connections testuser1,testuser2,testuser3
connection default;
disconnect testuser1;
disconnect testuser2;