📄 user_limits.result
字号:
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;iselect * from t1;iselect * 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;iselect * from t1;iselect * from t1;idelete 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;idelete from t1;ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates' resource (current value: 2)select * from t1;idrop user mysqltest_1@localhost;grant usage on *.* to mysqltest_1@localhost with max_connections_per_hour 2;flush user_resources;select * from t1;iselect * from t1;iconnect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections_per_hour' resource (current value: 2)select * from t1;iconnect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);ERROR 42000: User 'mysqltest_1' has exceeded the 'max_connections_per_hour' 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;iselect * from t1;iconnect(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;igrant usage on *.* to mysqltest_1@localhost with max_user_connections 3;flush user_resources;select * from t1;iconnect(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_connections0 0set session max_user_connections= 2;ERROR HY000: Variable 'max_user_connections' is a GLOBAL variable and should be set with SET GLOBALset global max_user_connections= 2;select @@session.max_user_connections, @@global.max_user_connections;@@session.max_user_connections @@global.max_user_connections2 2grant 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_connections2 2select * from t1;iconnect(localhost,mysqltest_1,,test,MYSQL_PORT,MYSQL_SOCK);ERROR 42000: User mysqltest_1 already has more than 'max_user_connections' active connectionsgrant 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_connections3 2connect(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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -