OS: CentOS 6.3

DB:5.5.14

mysql> show processlist;

+----+------+-----------+--------------------+---------+------+-------+------------------+

| Id | User | Host      | db                 | Command | Time | State | Info             |

+----+------+-----------+--------------------+---------+------+-------+------------------+

| 37 | root | localhost | information_schema | Query   |    0 | NULL  | show processlist |

| 38 | root | localhost | NULL               | Sleep   |  559 |       | NULL             |

+----+------+-----------+--------------------+---------+------+-------+------------------+

mysql> kill 40;

1 row in set (0.00 sec)

mysql> use information_schema

mysql> select id from processlist;

+----+

| id |

+----+

| 40 |

+----+

1 row in set (0.00 sec)

mysql> select concat('kill ',id,';') from information_schema.processlist where user='root' into outfile '/export/yoon.txt';

Query OK, 1 row affected (0.09 sec)

[root@db01 export]# more yoon.txt

kill 40;

批量删除会话:

mysql> source /export/yoon.txt

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐