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)