mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
1f6070a4b9
Made user_limits.test scheduling independant (this solves failure on QNX). Made sys_var_max_user_conn variable int sized. Changed max_user_connections from ulong to uint to be able to use it in sys_var_max_user_conn::value_ptr() (solves failures on 64-bit platforms). mysql-test/r/user_limits.result: Made test scheduling independant. mysql-test/t/user_limits.test: Made test scheduling independant. sql/mysql_priv.h: Made max_user_connections to be the same size as USER_RESOURCES::user_conn (to be able to use them in sys_var_max_user_conn::value_ptr()). sql/mysqld.cc: Made max_user_connections to be the same size as USER_RESOURCES::user_conn (to be able to use them in sys_var_max_user_conn::value_ptr()). sql/set_var.cc: sys_var::item(): Added support for int system variables. sql/set_var.h: Made sys_var_max_user_conn to be int sized variable.
96 lines
3.5 KiB
Text
96 lines
3.5 KiB
Text
drop table if exists t1;
|
|
create table t1 (i int);
|
|
delete from mysql.user where user like 'mysqltest\_%';
|
|
delete from mysql.db where user like 'mysqltest\_%';
|
|
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
|
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
|
flush privileges;
|
|
grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 2;
|
|
flush user_resources;
|
|
select * from t1;
|
|
i
|
|
select * from t1;
|
|
i
|
|
select * from t1;
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_questions' resource (current value: 2)
|
|
select * from t1;
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_questions' resource (current value: 2)
|
|
drop user mysqltest_1@localhost;
|
|
grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 2;
|
|
flush user_resources;
|
|
select * from t1;
|
|
i
|
|
select * from t1;
|
|
i
|
|
select * from t1;
|
|
i
|
|
delete from t1;
|
|
delete from t1;
|
|
delete from t1;
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates' resource (current value: 2)
|
|
select * from t1;
|
|
i
|
|
delete from t1;
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates' resource (current value: 2)
|
|
select * from t1;
|
|
i
|
|
drop user mysqltest_1@localhost;
|
|
grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;
|
|
flush user_resources;
|
|
select * from t1;
|
|
i
|
|
select * from t1;
|
|
i
|
|
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections' resource (current value: 2)
|
|
select * from t1;
|
|
i
|
|
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections' resource (current value: 2)
|
|
drop user mysqltest_1@localhost;
|
|
flush privileges;
|
|
grant usage on *.* to mysqltest_1@localhost with max_user_connections 2;
|
|
flush user_resources;
|
|
select * from t1;
|
|
i
|
|
select * from t1;
|
|
i
|
|
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 2)
|
|
select * from t1;
|
|
i
|
|
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
|
|
flush user_resources;
|
|
select * from t1;
|
|
i
|
|
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 3)
|
|
drop user mysqltest_1@localhost;
|
|
select @@session.max_user_connections, @@global.max_user_connections;
|
|
@@session.max_user_connections @@global.max_user_connections
|
|
0 0
|
|
set session max_user_connections= 2;
|
|
ERROR HY000: Variable 'max_user_connections' is a GLOBAL variable and should be set with SET GLOBAL
|
|
set global max_user_connections= 2;
|
|
select @@session.max_user_connections, @@global.max_user_connections;
|
|
@@session.max_user_connections @@global.max_user_connections
|
|
2 2
|
|
grant usage on *.* to mysqltest_1@localhost;
|
|
flush user_resources;
|
|
select @@session.max_user_connections, @@global.max_user_connections;
|
|
@@session.max_user_connections @@global.max_user_connections
|
|
2 2
|
|
select * from t1;
|
|
i
|
|
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
ERROR 42000: User mysqltest_1 already has more than 'max_user_connections' active connections
|
|
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
|
|
flush user_resources;
|
|
select @@session.max_user_connections, @@global.max_user_connections;
|
|
@@session.max_user_connections @@global.max_user_connections
|
|
3 2
|
|
connect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);
|
|
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_user_connections' resource (current value: 3)
|
|
set global max_user_connections= 0;
|
|
drop user mysqltest_1@localhost;
|
|
drop table t1;
|