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\_%';
8
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
15
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_questions' resource (current value: 2)
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;
30
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates' resource (current value: 2)
34
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates' resource (current value: 2)
37
drop user mysqltest_1@localhost;
38
grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
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)
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;
52
grant usage on *.* to mysqltest_1@localhost with max_user_connections 2;
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)
62
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
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
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
78
grant usage on *.* to mysqltest_1@localhost;
80
select @@session.max_user_connections, @@global.max_user_connections;
81
@@session.max_user_connections @@global.max_user_connections
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;
89
select @@session.max_user_connections, @@global.max_user_connections;
90
@@session.max_user_connections @@global.max_user_connections
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;