At the fine MySQL performance blog, the post, the author gives a sequence of MySQL queries to generate and run a sequence of queries to kill database connections. Once again, I had made a comparable home-brew script and so, as another diversion, I will provide my version:


for process in $(mysqladmin -uroot -ppassword processlist | awk "BEGIN { FS=\"|\" } \$4 ~ /$1/ { print \$2 }")
echo "Killing process $process"
mysqladmin -uroot -ppassword kill $process

Where, naturally, one would substitute the correct login information. The security information aside, I like this method a bit better as it is less interactive (I simply run the script on a given host and it kills all connections from that host) and it does not create any temporary files to be cleaned up later. The caveat, of course, is that it kills all connections for a host--it does not allow for cherry picking.