1
# Check for error if no parameter provided
4
SELECT SCHEMA_NAME FROM DATA_DICTIONARY.SCHEMAS ORDER BY SCHEMA_NAME;
6
# Set up a table to be able to test not being able to kill other people
8
create table t1 (kill_id int);
9
insert into t1 values(connection_id());
11
# Test that we get a normal don't exist error for things that don't exist
12
--error ER_TABLE_UNKNOWN
13
SELECT * from user1.dont_exist;
15
# Connect as user1 - should only see information_schema, user1 and
17
# Also tests that we are able to read data_dictionary, without which fail
19
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
20
connect (should_succeed,localhost,user1,,user1,,);
21
connection should_succeed;
22
SELECT SCHEMA_NAME FROM DATA_DICTIONARY.SCHEMAS ORDER BY SCHEMA_NAME;
24
# Test that we get blocked on not being allowed to see user2 at all before
25
# we get blocked on the table not existing
26
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
27
--replace_regex /@'.*?'/@'LOCALHOST'/
28
--error ER_DBACCESS_DENIED_ERROR
29
SELECT * from user2.dont_exist;
31
# Test that we can't create a schema that isn't named the same as we are
32
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
33
--replace_regex /@'.*?'/@'LOCALHOST'/
34
--error ER_DBACCESS_DENIED_ERROR
35
create schema authorize_fail;
37
# Test that we can't drop a schema that isn't named the same as we are
38
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
39
--replace_regex /@'.*?'/@'LOCALHOST'/
40
--error ER_DBACCESS_DENIED_ERROR
43
# Set up a table to test that we can kill other versions of us
44
create table t1 (kill_id int);
45
insert into t1 values(connection_id());
47
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
48
connect (con1,localhost,user1,,user1,);
49
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
50
connect (con2,localhost,user2,,user2,);
53
# Check that we don't see other people's connections
54
SELECT USERNAME, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USERNAME, DB;
56
# Check that we can kill a process that is owned by our user
58
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
61
connection should_succeed;
66
# One of the following statements should fail
67
--error EE_OK,EE_BADCLOSE,EE_UNKNOWN_CHARSET,EE_CANT_SYMLINK
69
--error EE_OK,EE_BADCLOSE,EE_UNKNOWN_CHARSET,EE_CANT_SYMLINK
75
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
76
select @id != connection_id();
78
# Set the table to our current id now
79
update t1 set kill_id = connection_id();
81
# Test that we cannot kill a process owned by someone else
83
SELECT USERNAME, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USERNAME, DB;
84
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
86
--replace_regex /Unknown session id: [0-9]+/Unknown session id: #/
87
--error ER_NO_SUCH_THREAD
90
# Test that root can see everybody
92
SELECT USERNAME, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USERNAME, DB;
94
# Test that root can kill someone else
97
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
100
connection should_succeed;
105
# One of the following statements should fail
106
--error EE_OK,EE_BADCLOSE,EE_UNKNOWN_CHARSET,EE_CANT_SYMLINK
108
--error EE_OK,EE_BADCLOSE,EE_UNKNOWN_CHARSET,EE_CANT_SYMLINK
114
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
115
select @id != connection_id();
118
# Test failing initial connection
119
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
120
--replace_regex /@'.*?'/@'LOCALHOST'/
121
--error ER_DBACCESS_DENIED_ERROR
122
connect (should_fail,localhost,authz,,authz_no,,);
124
# Clean up after ourselves
130
disconnect should_succeed;