You are hereKilling a MySQL Runaway Query

Killing a MySQL Runaway Query


By steve - Posted on 14 November 2008

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)

Tags

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.



Sponsors



Apple Store


Apple Online Store











TigerDirect


Windows Vista Memory








Shop4Tech





Official PayPal Seal