Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MYSQL: To kill process using sys_exec()

Tags:

shell

mysql

Question: How to kill process using sys_exec().
I am trying to execute shell script using the sys_exec().
my shell script contains

killall process_name 

when i execute above script, at that time it is not calling

killall process_name

command. But it executes other operations like `

sys_exec(touch filename.txt);`

How to execute above shellscript?

like image 956
Logicbomb Avatar asked Jul 06 '15 04:07

Logicbomb


1 Answers

If you have MySQL 5.1 where the processlist is in the INFORMATION_SCHEMA, you can do this to generate the KILL QUERY commands in bulk from within the mysql client:

SELECT GROUP_CONCAT(CONCAT('KILL QUERY ',id,';') SEPARATOR ' ') KillQuery
FROM information_schema.processlist WHERE user<>'system user'\G

You might want to take a look at these links

http://dbadiaries.com/how-to-kill-all-mysql-processes-for-a-specific-user https://dba.stackexchange.com/questions/2634/kill-all-queries-mysql

like image 167
Abhinav Avatar answered Oct 09 '22 00:10

Abhinav