Home > Database > Mysql Tutorial > 批量kill mysql进程_MySQL

批量kill mysql进程_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:36:46
Original
1259 people have browsed it

bitsCN.com

批量kill mysql进程

 

如果大批量的操作能够通过一系列的select语句产生,那么理论上就能对这些结果批量处理。    

但是mysql并没用提供eval这样的对结果集进行分析操作的功能。所以只能现将select结果保存到临时文件中,然后再执行临时文件中的指令。

具体过程如下:

 

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

+------------------------+

| 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)

 

mysql> source /tmp/a.txt;

Query OK, 0 rows affected (0.00 sec)

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template