Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5450764
  • 博文数量: 348
  • 博客积分: 2173
  • 博客等级: 上尉
  • 技术积分: 7900
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-24 17:26
个人简介

雄关漫道真如铁,而今迈步从头越。

文章存档

2022年(4)

2020年(6)

2019年(2)

2018年(2)

2017年(34)

2016年(49)

2015年(53)

2014年(47)

2013年(72)

2012年(79)

分类: Mysql/postgreSQL

2017-03-18 21:12:46

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;
阅读(3298) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~