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

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2021-07-10
  • 2021-12-06
  • 2021-12-20
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-13
  • 2022-12-23
  • 2022-01-02
  • 2021-12-19
  • 2022-01-21
  • 2021-05-22
  • 2021-06-03
相关资源
相似解决方案