How can I kill MySQL queries every 60 seconds in Windows?
Posted
by
Ethan Allen
on Stack Overflow
See other posts from Stack Overflow
or by Ethan Allen
Published on 2012-09-30T20:20:06Z
Indexed on
2012/09/30
21:37 UTC
Read the original article
Hit count: 197
I want to check my MySQL server every minute and kill queries that have run longer than 150 seconds. The main reason I want to do this is because I don't want queries from certain people to lock up the DB for everyone else. I know this is not the ultimate solution to the problem, but at least it's a fallback in case something goes wrong with a query. I don't have a slave DB (this is just an at-home project).
I'd like to schedule a script to run that does this for me. I'm unfamiliar with Perl or Ruby and I need it done on my Windows 2008 Server box. I've looked into creating a simple cmd line script, but that doesn't seem to be possible. I know currently I can do something like this but I have to do it manually:
mysqladmin processlist
mysqladmin kill
Anyone have any ideas or examples on how I could do this?
© Stack Overflow or respective owner