当前位置:   article > 正文

Mysql Too many connections_mysql too many 登录

mysql too many 登录

整理Mysql "Too many connections" 解决办法_Curry_liang-CSDN博客

为了防止发生too many connections时候无法登录的问题,mysql manual有如下的说明:

mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected.

因此, 必须只 赋予root用户的SUPER权限,同时所有数据库连接的帐户不能赋予SUPER权限。前面说到的报错后无法登录就是由于我们的应用程序直接配置的root用户

查看当前数据库的所有用户:
select user,host,password from mysql.user;

给用户赋予super权限(super和ALL PRIVILEGES都可以):
GRANT super ON *.* TO 'mysql'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'localhost';

删除用户的super权限(super和ALL PRIVILEGES都可以):
REVOKE super ON *.* FROM 'mysql'@'localhost';
REVOKE ALL PRIVILEGES ON *.* FROM 'mysql'@'localhost';

查看赋予用户的权限
SHOW GRANTS FOR 'mysql'@'localhost';

微信扫一扫:关注我个人订阅号“猿小飞”,更多精彩文章在这里及时发布:

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/337107
推荐阅读
相关标签
  

闽ICP备14008679号