mysql 批量删除process

mysql>show processlist; 查看数据库中所有进程

mysql> select concat('KILL ',id,';') from information_schema.processlist where user='root'and db = 'onlineshow';
+------------------------+
| concat('KILL ',id,';') 
+------------------------+
| KILL 3101;             
| KILL 2946;             
+------------------------+
2 rows in set (0.00 sec)
 
mysql>select concat('KILL ',id,';') from information_schema.processlist where user='root' into outfile '/tmp/a.txt';
Query OK, 2 rows affected (0.00 sec)
 !!!!注意 /tmp/a.txt 路径不对, 在根目录下查找find . -name 'a.txt'  是在/var/lib/mysql/a.txt 目录下
mysql>source /var/lib/mysql/a.txt;
Query OK, 0 rows affected (0.00 sec)

 

 
posted @ 2018-04-23 16:24  sowhat1412  阅读(768)  评论(0编辑  收藏  举报