1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
create schema user1;
create schema user2;
SELECT SCHEMA_NAME FROM DATA_DICTIONARY.SCHEMAS ORDER BY SCHEMA_NAME;
SCHEMA_NAME
DATA_DICTIONARY
INFORMATION_SCHEMA
mysql
test
user1
user2
use user2;
create table t1 (kill_id int);
insert into t1 values(connection_id());
SELECT * from user1.dont_exist;
ERROR 42S02: Table 'user1.dont_exist' doesn't exist
SELECT SCHEMA_NAME FROM DATA_DICTIONARY.SCHEMAS ORDER BY SCHEMA_NAME;
SCHEMA_NAME
DATA_DICTIONARY
INFORMATION_SCHEMA
user1
SELECT * from user2.dont_exist;
ERROR 42000: Access denied for user 'user1'@'LOCALHOST' to schema 'user2'
create schema authorize_fail;
ERROR 42000: Access denied for user 'user1'@'LOCALHOST' to schema 'authorize_fail'
drop schema user2;
ERROR 42000: Access denied for user 'user1'@'LOCALHOST' to schema 'user2'
create table t1 (kill_id int);
insert into t1 values(connection_id());
SELECT USERNAME, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USERNAME, DB;
USERNAME DB
user1 user1
user1 user1
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
IF(((@id := kill_id) - kill_id), "NO", "YES")
YES
kill @id;
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
IF(((@id := kill_id) - kill_id), "NO", "YES")
YES
select @id != connection_id();
@id != connection_id()
1
update t1 set kill_id = connection_id();
SELECT USERNAME, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USERNAME, DB;
USERNAME DB
user2 user2
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
IF(((@id := kill_id) - kill_id), "NO", "YES")
YES
kill @id;
ERROR HY000: Unknown session id: #
SELECT USERNAME, DB FROM DATA_DICTIONARY.PROCESSLIST ORDER BY USERNAME, DB;
USERNAME DB
root user2
user1 user1
user1 user1
user2 user2
use user1;
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
IF(((@id := kill_id) - kill_id), "NO", "YES")
YES
kill @id;
select IF(((@id := kill_id) - kill_id), "NO", "YES") from t1;
IF(((@id := kill_id) - kill_id), "NO", "YES")
YES
select @id != connection_id();
@id != connection_id()
1
connect(localhost,authz,,authz_no,MASTER_PORT,);
ERROR 42000: Access denied for user 'authz'@'LOCALHOST' to schema 'authz_no'
drop schema user1;
drop schema user2;
|