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. web 分类 和使用Dreamweaver

    1.iE 2.火狐的fox 3.谷歌的Chrome 在编写的代码要符合W3c统一的国际标准 二:使用Dreamweaver: Dreamweaver只能用辅助,生成的代码要修改,…… ———编写的代码 ...

  2. 剑指Offer31 把数组排成最小的数

    /************************************************************************* > File Name: 31_SortAr ...

  3. 利用spring自己实现观察者模式

    利用spring,自己实现的一个观察者模式,写着玩玩,目的是为了加深理解,下次用Spring自带的玩一玩. 首先我们定义一个侦听类接口 package com.hyenas.common.listen ...

  4. 转:云风skynet服务端框架研究

    转:  http://forthxu.com/blog/skynet.html skynet是云风编写的服务端底层管理框架,底层由C编写,配套lua作为脚本使用,可换python等其他脚本语言.sky ...

  5. P1111 修复公路

    P1111 修复公路 550通过 1.6K提交 题目提供者该用户不存在 标签并查集 难度普及/提高- 提交该题 讨论 题解 记录   题目背景 A地区在地震过后,连接所有村庄的公路都造成了损坏而无法通 ...

  6. C#之ArrayList

    using System.Collections; 新建: ArrayList list = new ArrayList(); 添加元素: int a = 1; list.Add(a); 遍历: fo ...

  7. 你如何理解HTML结构的语义化?

    去掉或样式丢失的时候能让页面呈现清晰的结构: html本身是没有表现的,我们看到例如<h1>是粗体,字体大小2em,加粗:<strong>是加粗的,不要认为这是html的表现, ...

  8. js解析xml,获取XMl标签属性值

    <script type="text/javascript"> var xml="<?xml version=\"1.0\" enc ...

  9. sql深入理解

    我们做软件开发的,大部分人都离不开跟数据库打交道,特别是erp开发的,跟数据库打交道更是频繁,存储过程动不动就是上千行,如果数据量大,人员流动大,那么我们还能保证下一段时间系统还能流畅的运行吗?我们还 ...

  10. Shanghai InfoSys .NET engineer telephone interview

    Collect the answers,interested friends from research. 1,Interface and Abstract difference? 2,Generic ...