Little bash snippet to kill locking queries from MySQL
Oktober 9th, 2008 by Blu:RayNe
I just tell you: optimize your tables! I will not give anymore support for bad code, stupid database layout and i am not going to debug your messy code. If you don’t get the introductino chapters of MySQL – stay away from me! Yep, it was just one of these days…
#!/bin/bash
echo "Killing MySQL Queries…"
MYSQL="$(which mysql)"
MyUSER="username"
MyPASS="password"
echo "Killing MySQL Queries…"
MYSQL="$(which mysql)"
MyUSER="username"
MyPASS="password"
for pid in `mysqladmin proc -u$MyUSER -p$MyPASS | grep -i Query | grep -i lock|awk ‘{ print $2;}’`
do
query="KILL $pid;"
echo "> $query";
$MYSQL -u$MyUSER -p$MyPASS -e "$query"
done;
Filed under Datenbanken having