How do I kill all the processes in Mysql “show processlist”?

后端 未结 23 1940
温柔的废话
温柔的废话 2020-12-04 04:49

Because I see a lot of processes there, and the \"time\" column shows big values for all of them.

23条回答
  •  悲&欢浪女
    2020-12-04 05:29

    login to Mysql as admin:

     mysql -uroot -ppassword;
    

    And than run command:

    mysql> show processlist;
    

    You will get something like below :

    +----+-------------+--------------------+----------+---------+------+-------+------------------+
    | Id | User        | Host               | db       | Command | Time | State | Info             |
    +----+-------------+--------------------+----------+---------+------+-------+------------------+
    | 49 | application | 192.168.44.1:51718 | XXXXXXXX | Sleep   |  183 |       | NULL             ||
    | 55 | application | 192.168.44.1:51769 | XXXXXXXX | Sleep   |  148 |       | NULL             |
    | 56 | application | 192.168.44.1:51770 | XXXXXXXX | Sleep   |  148 |       | NULL             |
    | 57 | application | 192.168.44.1:51771 | XXXXXXXX | Sleep   |  148 |       | NULL             |
    | 58 | application | 192.168.44.1:51968 | XXXXXXXX | Sleep   |   11 |       | NULL             |
    | 59 | root        | localhost          | NULL     | Query   |    0 | NULL  | show processlist |
    +----+-------------+--------------------+----------+---------+------+-------+------------------+
    

    You will see complete details of different connections. Now you can kill the sleeping connection as below:

    mysql> kill 52;
    Query OK, 0 rows affected (0.00 sec)
    

提交回复
热议问题