'root' has exceeded the 'max_questions' resource (current value: 100) (1226)


同事遇到一问题

mysqldump: Couldn't execute 'select @@collation_database': User 'root' has exceeded the 'max_questions' resource (current value: 100) (1226)

按照提示很容易想到 max_questions 值太大了,目前只有100,所以报错。


首先想到show variables like 'r'  居然没有找到,这个应该不是个全局的参数,那么在哪儿呢?应该在系统表里。

然后进去的数据库里面,想看下多少连接,show full processlist,报一样的错误,任何的select 语句都是报这个错误。

幸好只是个开发测试库,所以直接重启DB应该可以解决此问题。果不其然,重启之后一切ok。


进入到mysql库,查看user表,发现如下字段

 max_questions          | int(11) unsigned                  | NO   |     | 0       |       

此库设置的值确实为100,改为0,刷新权限。

一般情况下,用户是不会修改这个值,0的话就是没有限制,不知道谁手欠,修改了这个值。

按照这样,应该是针对单个用户的限制。

解决此问题,应该用别的超级权限的用户登录,直接修改这个值,然后刷新权限,不重启db应该也可以解决。

查官方文档又发现5.6版本新加的字段password_expired用来控制密码过期。


看下官方文档

mysql> GRANT USAGE ON *.* TO 'francis'@'localhost'  WITH MAX_QUERIES_PER_HOUR 100;
mysql> GRANT USAGE ON *.* TO 'francis'@'localhost'  WITH MAX_CONNECTIONS_PER_HOUR 0;


The server stores resource limits for an account in the user table row corresponding to the account. The max_questions, max_updates, and max_connections columns store the per-hour limits, and the max_user_connections column stores the MAX_USER_CONNECTIONS limit. 



  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值