Because I see a lot of processes there, and the \"time\" column shows big values for all of them.
#! /bin/bash
if [ $# != "1" ];then
echo "Not enough arguments.";
echo "Usage: killQueryByDB.sh <db_name>";
exit;
fi;
DB=${1};
for i in `mysql -u <user> -h localhost ${DB} -p<password> -e "show processlist" | sed 's/\(^[0-9]*\).*/\1/'`; do
echo "Killing query ${i}";
mysql -u <user> -h localhost ${DB} -p<password> -e "kill query ${i}";
done;
We can do it by MySQL Workbench. Just execute this:
kill id;
Example:
kill 13412
That will remove it.
I used the command flush tables
to kill all inactive connections which where actually the mass problem.
Query 1 select concat('KILL ',id,';') from information_schema.processlist where user='username' into outfile '/tmp/a.txt';
Query 2 source a.txt
This will enable you to kill all the queries in show processlist by specific user.
mysqladmin pr -u 'USERNAME' -p'PASSWORD' | awk '$2~/^[0-9]+/{print $2}' | xargs -i mysqladmin -u 'USERNAME' -p'PASSWORD' kill {}