1
by brian
clean slate |
1 |
drop table if exists t1;
|
2 |
create table t1 (i int);
|
|
3 |
delete from mysql.user where user like 'mysqltest\_%';
|
|
4 |
delete from mysql.db where user like 'mysqltest\_%';
|
|
5 |
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
|
6 |
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
|
7 |
flush privileges;
|
|
8 |
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
|
|
9 |
flush user_resources;
|
|
10 |
select * from t1;
|
|
11 |
i
|
|
12 |
select * from t1;
|
|
13 |
i
|
|
14 |
select * from t1;
|
|
15 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_questions' resource (current value: 2)
|
|
16 |
select * from t1;
|
|
17 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_questions' resource (current value: 2)
|
|
18 |
drop user mysqltest_1@localhost;
|
|
19 |
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2;
|
|
20 |
flush user_resources;
|
|
21 |
select * from t1;
|
|
22 |
i
|
|
23 |
select * from t1;
|
|
24 |
i
|
|
25 |
select * from t1;
|
|
26 |
i
|
|
27 |
delete from t1;
|
|
28 |
delete from t1;
|
|
29 |
delete from t1;
|
|
30 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates' resource (current value: 2)
|
|
31 |
select * from t1;
|
|
32 |
i
|
|
33 |
delete from t1;
|
|
34 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates' resource (current value: 2)
|
|
35 |
select * from t1;
|
|
36 |
i
|
|
37 |
drop user mysqltest_1@localhost;
|
|
38 |
grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
|
|
39 |
flush user_resources;
|
|
40 |
select * from t1;
|
|
41 |
i
|
|
42 |
select * from t1;
|
|
43 |
i
|
|
44 |
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
45 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections_per_hour' resource (current value: 2)
|
|
46 |
select * from t1;
|
|
47 |
i
|
|
48 |
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
49 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections_per_hour' resource (current value: 2)
|
|
50 |
drop user mysqltest_1@localhost;
|
|
51 |
flush privileges;
|
|
52 |
grant usage on *.* to mysqltest_1@localhost with max_user_connections 2;
|
|
53 |
flush user_resources;
|
|
54 |
select * from t1;
|
|
55 |
i
|
|
56 |
select * from t1;
|
|
57 |
i
|
|
58 |
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
59 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 2)
|
|
60 |
select * from t1;
|
|
61 |
i
|
|
62 |
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
|
|
63 |
flush user_resources;
|
|
64 |
select * from t1;
|
|
65 |
i
|
|
66 |
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
67 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 3)
|
|
68 |
drop user mysqltest_1@localhost;
|
|
69 |
select @@session.max_user_connections, @@global.max_user_connections;
|
|
70 |
@@session.max_user_connections @@global.max_user_connections
|
|
71 |
0 0
|
|
72 |
set session max_user_connections= 2;
|
|
73 |
ERROR HY000: Variable 'max_user_connections' is a GLOBAL variable and should be set with SET GLOBAL
|
|
74 |
set global max_user_connections= 2;
|
|
75 |
select @@session.max_user_connections, @@global.max_user_connections;
|
|
76 |
@@session.max_user_connections @@global.max_user_connections
|
|
77 |
2 2
|
|
78 |
grant usage on *.* to mysqltest_1@localhost;
|
|
79 |
flush user_resources;
|
|
80 |
select @@session.max_user_connections, @@global.max_user_connections;
|
|
81 |
@@session.max_user_connections @@global.max_user_connections
|
|
82 |
2 2
|
|
83 |
select * from t1;
|
|
84 |
i
|
|
85 |
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
86 |
ERROR 42000: User mysqltest_1 already has more than 'max_user_connections' active connections
|
|
87 |
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
|
|
88 |
flush user_resources;
|
|
89 |
select @@session.max_user_connections, @@global.max_user_connections;
|
|
90 |
@@session.max_user_connections @@global.max_user_connections
|
|
91 |
3 2
|
|
92 |
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
93 |
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 3)
|
|
94 |
set global max_user_connections= 0;
|
|
95 |
drop user mysqltest_1@localhost;
|
|
96 |
drop table t1;
|