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. codeforces 677B B. Vanya and Food Processor(模拟)

    题目链接: B. Vanya and Food Processor time limit per test 1 second memory limit per test 256 megabytes i ...

  2. 洛谷P1717 钓鱼

    P1717 钓鱼 41通过 116提交 题目提供者该用户不存在 标签贪心 难度提高+/省选- 提交该题 讨论 题解 记录 最新讨论 暂时没有讨论 题目描述 话说发源于小朋友精心设计的游戏被电脑组的童鞋 ...

  3. 常用字符串API

    java.lang.string.1.0 1.char charAt(int index)  返回给定位置的代码单元. 2.int codePointAt(int index) 返回从给定位置开始或字 ...

  4. Javascript中二级联动

    主要使用到到了地址JSON格式,来做,没有涉及数据库的读取. <!DOCTYPE html><html><head> <meta charset=" ...

  5. C# WinForm 调用WebService

    在Winform中对数据库进行操作缺乏安全性,因而可以使用Winform调用WebService来实现对数据库的各种操作. 在VS2010中,创建一个Web服务程序,第一:创建一个空的Web应用程序, ...

  6. C#_枚举类型

     C#中的枚举是名/值对的数据类型,下面是自定义的军衔等级的枚举 //定义枚举 enum MilitaryRank { Commander, ArmyCorpCommander, Military ...

  7. 更改Activity亮度

    有些需求需进入到页面后更改Activity的亮度,退出页面后恢复到之前的亮度.通过更改WindowManager.LayoutParams的screenBrightness可以达到这个效果.scree ...

  8. sql调用方法精简

    <%If IsArray(proList) Then%> <UL class="product-ul"> <%For x=0 to Ubound(pr ...

  9. mac下apache的多站点配置

    以下操作均建立在    已经配置好了php环境 从网上搜索了下,后来自己配置了下还是比较简单的! 我的环境目录是在/Library/webServer/Documents 测试的时候可以直接在这里建立 ...

  10. seaJS常用语法

    .seajs.config seajs.config({ // 设置路径,方便跨项目调用 paths: { 'path1': '....', 'path2': '....' }, // 设置别名,方便 ...