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

MySQL批量杀进程的更多相关文章

  1. mysql 批量杀进程

    select concat('KILL ',id,';') from information_schema.processlist where user='root';

  2. 【Linux】使用awk批量杀进程

    pkill 杀一个用户的所有进程 pkill -u bingo 批量杀进程 使用ps -ef|grep aaa 查出相关进程 使用grep -v grep 过滤掉grep本身产生的进程 使用awk 打 ...

  3. Linux 批量杀进程的命令

    使用awk批量杀进程的命令: ps -ef | grep firefox | grep -v grep | awk '{print "kill -9 "$2}'|sh #列出了当前 ...

  4. shell批量杀进程

    ps aux |grep java |grep -v 'grep java'|awk {'print $2'}|xargs kill -9 ps aux |grep java 查询包含‘java’的进 ...

  5. 批量杀进程——xargs用途

    ps -ef|grep ora|grep “LOCAL=YES”|awk ‘{print $2}’|xargs –I {} kill -9 {} ps -ef|grep ora|grep “LOCAL ...

  6. [Linux]使用awk批量杀进程的命令

    碰到需要杀掉某一类进程的时候,如何批量杀掉这些进程,使用awk命令是很好的选择. ps -ef|grep aaa|grep -v grep|awk '{print "kill -9 &quo ...

  7. 使用awk批量杀进程的命令

    在做系统运维的过程中,有时候会碰到需要杀掉某一类进程的时候,如何批量杀掉这些进程,使用awk命令是很好的选择. ps -ef|grep aaa|grep -v grep|awk '{print &qu ...

  8. [转]使用awk批量杀进程的命令

    1. ps -ef|grep aaa|grep -v grep 这是大家很熟悉的命令,这里就不再多说,就是从当前系统运行的进程的进程名中包含aaa关键字的进程. 2. 后面部分就是awk命令了,一般a ...

  9. MySQL 批量杀mysql线程

    mysql> SELECT concat('KILL ',id,';') FROM information_schema.processlist WHERE user='root'; +---- ...

随机推荐

  1. Oracle基础(八) 数据完整性

    一.数据完整性 数据完整性要求数据库中的数据具有准确性.准确性是通过数据库表的设计和约束来实现的.为了实现数据完整性,数据库需要做两方面的工作: 确保每行的数据符合要求. 确保每列的数据符合要求. 为 ...

  2. Umbraco(4)-Outputting the Document Type Properties(翻译文档)

    翻译原文地址:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/umbraco4outputting-the-document-typ ...

  3. Input框去掉蓝色边框

    Input框去掉蓝色边框: <input type="text" name="" value="" class="Inpt& ...

  4. 写入数据到Plist文件中时,第一次要创建一个空的数组,否则写入文件失败

    #pragma mark - 保存数据到本地Plist文件中 - (void)saveValidateCountWithDate:(NSString *)date count:(NSString *) ...

  5. Hibernate学习小结

    之前从事.net开发的三年经验里,我是用过EF.Microsoft Dynamic crm中集成的ORM以及上一家公司自主开发的ORM. 再接触Hibernate后,上手比较简单,但其提供了大量的接口 ...

  6. vijos 1053Easy sssp

    P1053Easy sssp Accepted 标签:图结构 最短路     描述 输入数据给出一个有N(2 <= N <= 1,000)个节点,M(M <= 100,000)条边的 ...

  7. Unity3d之截图

    1.Application.CaptureScreenshot("Screenshot.png", 0); 2. exture2D CaptureScreenshot2(Rect  ...

  8. html&css静态页面

    状态不好,整晚未眠. 想着敲点代码,遇着复杂的又自己生气,所以就敲了博客园的,总是很纠结"哪样的文字算标题算段落或要用span""什么时候用div比较好"&qu ...

  9. css改变谷歌浏览器的滚动条样式

    详细内容请点击 /*---滚动条默认显示样式--*/ ::-webkit-scrollbar-thumb{        height:50px;    outline-offset:-2px;   ...

  10. java识别验证码

    所需资源下载链接(资源免费,重在分享) Tesseract:http://download.csdn.net/detail/chenyangqi/9190667 jai_imageio-1.1-alp ...