什么可能导致所有MySQL连接睡眠?

时间:2014-01-02 19:12:33

标签: mysql connection sleep

出于某种原因,即使数据库实际上没有做任何事情,与本地数据库的连接也会进入休眠状态:

mysql> SHOW FULL PROCESSLIST;
+-----+------+-----------+-----+---------+------+-------+-----------------------+
| Id  | User | Host      | db  | Command | Time | State | Info                  |
+-----+------+-----------+-----+---------+------+-------+-----------------------+
|  85 | root | localhost | *** | Sleep   |  810 |       | NULL                  |
|  88 | root | localhost | *** | Sleep   |  662 |       | NULL                  |
|  89 | root | localhost | *** | Sleep   |  586 |       | NULL                  |
|  93 | root | localhost | *** | Sleep   |  692 |       | NULL                  |
|  98 | root | localhost | *** | Sleep   |  719 |       | NULL                  |
| 102 | root | localhost | *** | Sleep   |  545 |       | NULL                  |
| 182 | root | localhost | *** | Query   |    0 | init  | SHOW FULL PROCESSLIST |
| 263 | root | localhost | *** | Sleep   |  809 |       | NULL                  |
| 275 | root | localhost | *** | Sleep   |  660 |       | NULL                  |
| 279 | root | localhost | *** | Sleep   |  584 |       | NULL                  |
| 282 | root | localhost | *** | Sleep   |    1 |       | NULL                  |
| 283 | root | localhost | *** | Sleep   |  544 |       | NULL                  |
+-----+------+-----------+-----+---------+------+-------+-----------------------+
12 rows in set (0.00 sec)

没有新连接,也没有锁定,但不知道请求是否正在处理中。知道是什么导致了这个吗?

1 个答案:

答案 0 :(得分:1)

在此上下文中,Sleep仅表示线程处于空闲状态。以下是manual

的定义
  
      
  • 睡眠
  •   
     

线程正在等待客户端向其发送新语句。