1、MAX_QUERIES_PER_HOUR 用来限制用户每小时运行的查询数量
mysql> grant select on *.* to
'cu_blog'@'localhost' identified by '123456' with
max_queries_per_hour 5;
Query OK, 0 rows affected (0.00 sec)
...
mysql> select user();
+-------------------+
| user() |
+-------------------+
|
cu_blog@localhost |
+-------------------+
1 row in set (0.00 sec)
当到了指定的次数时就会报错
mysql> select user();
ERROR 1226 (42000): User 'cu_blog' has exceeded the 'max_questions' resource (cu
rrent value: 5)
2、MAX_UPDATES_PER_HOUR 用来限制用户每小时的修改数据库数据的数量。
mysql> grant select on *.* to
'cu_blog'@'localhost' with max_updates_per_hour 5;
Query OK, 0 rows affected (0.00 sec)
3、MAX_CONNECTIONS_PER_HOUR用来控制用户每小时打开新连接的数量。
mysql> grant select on *.* to
'cu_blog'@'localhost' with max_connections_per_hou
r 5;
Query OK, 0 rows affected (0.00 sec)
4、MAX_USER_CONNECTIONS 限制有多少用户连接MYSQL服务器。
mysql> grant select on *.* to
'cu_blog'@'localhost' with max_user_connections 2;
Query OK, 0 rows affected (0.00 sec)
5、要想将所有账户当前的记数重设为零,可以执行FLUSH USER_RESOURCES语句。还可以通过重载授权表来重设记数。
mysql> flush user_resources;
阅读(3429) | 评论(0) | 转发(0) |