我有一个rails 4应用程序的问题,它留下了空闲的mysql连接。当我们查看代码以确定原因时,我至少希望能够自动消除有问题的过程。mysql文档说,设置wait_timeout和interactive_timeout将关闭非活动连接,所以我将它们都设置为300。然而,从下面可以看出,存在超过300限制的各种过程。我已经确认设置确实是300。为什么mysql没有消除这些过程?
mysql>显示进程列表;+-----+--------------+-----------+--------------+---------+------+-------+------------------+|Id|用户|主机|数据库|命令|时间|状态|信息|+-----+--------------+-----------+--------------+---------+------+-------+------------------+|143|application|localhost|application|Sleep|1500||NULL||144|application|localhost|application|Sleep|1499||NULL||145|application|localhost|application|Sleep|0||NULL||146|application|localhost|application|Sleep|780||NULL||147|application|localhost|application|Sleep|783||NULL||148|application|localhost|application|Sleep|0||NULL||149|application|localhost|application|Sleep|7||NULL||150|application|localhost|application|Sleep|3||NULL||151|application|localhost|application|Sleep|8||NULL||152|application|localhost|application|Sleep|3||NULL||155|root|localhost|NULL |查询|0|NULL |显示进程列表|+-----+--------------+-----------+--------------+---------+------+-------+------------------+一组11行(0.00秒)
尝试运行mysql查询kill 143;
这对我有效