You are hereKilling a MySQL Runaway Query
Killing a MySQL Runaway Query
I had a client using mysql create an SQL query that was going to result in a few gazillion rows and this query was bogging down the server. Since I use the PostgreSQL command line a lot more frequently than the mysql command line, it took me awhile to remember what to do to find the query that was the problem. It is really quite simple...
# mysql -u root
# SHOW PROCESSLIST;
(scan thru and find the problematic query)
# KILL QUERY #####;
(where ##### is the ID you want to kill as found in column 1 of the SHOW PROCESSLIST results)
Comments
Did this help you? You can help me!
Did you find this information helpful? You can help me back by linking to this page, purchasing from my sponsors, or posting a comment!
+One me on Google:
Follow me on twitter: http://twitter.com/mojocode






This worked great. Does anybody know how to prevent a single thread from scarfing up 100% of the CPU when a query is bad like this? I don't think mysql should allow this.
You can also automate the killing of runaway queries. http://su.pr/7370jg