Shell-script - Bash scripting to kill mysql locked process, Kill mysql Locked connection by user name

Bash scripting to kill mysql locked process

The below bash script will help you to kill all the mysql locked connection of a specific user.

for i in `mysqladmin -h x.x.x.x --user=root -pXXXX processlist |
grep <username>| grep <Locked>|
awk {'print $2'}` do
mysqladmin -h x.x.x.x --user=root -pXXX kill $i;
done;

substitute the username and process accordingly.

The topic on Shell-script - Bash scripting to kill mysql locked process is posted by - Maha

Hope you have enjoyed, Shell-script - Bash scripting to kill mysql locked processThanks for your time

Tech Bluff