【问题标题】:SHOW PROCESSLIST shows only 20 connections, while server sais "has more than 'max_user_connections' active connections"SHOW PROCESSLIST 仅显示 20 个连接,而服务器 sais “有超过 'max_user_connections' 活动连接”
【发布时间】:2013-03-11 13:22:42
【问题描述】:

我不是什么问题,怎么看:

SHOW PROCESSLIST 仅显示 20 个连接,而服务器 sais “有超过 'max_user_connections' 个活动连接”,即 400。

这是为什么呢?

【问题讨论】:

    标签: mysql connection processlist


    【解决方案1】:

    您确定错误中提到了max_user_connections?这是每个 MySQL 用户的限制,而不是针对整个服务器,默认为 0,这意味着每个用户都可以使用所有可用的连接。 max_connections 指定 MySQL 一次可以接受的绝对连接数,这可能在您的服务器上设置为 400。

    SHOW PROCESSLIST 将始终显示所有活动连接。但是,您的客户可能会限制其输出。

    您可以通过 SQL 命令show variables like 'max%connections'; 检查服务器变量,这将输出两个设置:

    mysql> show variables like 'max%connections';
    +----------------------+-------+
    | Variable_name        | Value |
    +----------------------+-------+
    | max_connections      | 300   |
    | max_user_connections | 0     |
    +----------------------+-------+
    2 rows in set (0.00 sec)
    

    【讨论】:

    • 如果这些是短暂的连接(例如 PHP 连接,发送很少的查询,然后在 1 秒内断开连接),那么有可能在某个时间所有 30 个都被使用,但在那之后的几秒钟使用了 20 个...因此您需要增加用户的限制。
    【解决方案2】:

    还要确保您拥有正确的 process permission 。如果您无权查看其他用户的进程,则显示进程列表不会显示他们

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-01
      • 2020-12-21
      • 2017-12-21
      • 2014-05-20
      • 2014-06-14
      • 2016-03-09
      • 1970-01-01
      相关资源
      最近更新 更多