Last Updated: February 25, 2016
·
943
· anupamaa

Terminate a renegade MySQL query

I was trying to join two MySQL tables, both of which had over 8 Million rows. As a result, the query got stuck and both the tables became inaccessible.

The simplest way to terminate a renegade query like this is to use the following -

Go to MySQL prompt and run the following command

> SHOW PROCESSLIST;

This will enlist all the MySQL processes under your username. Spot the Process ID (which is a numeric value like 123) of the query you want to terminate and then use the following command

> KILL 123;

where 123 is the process ID of the MySQL connection for that query.

This usually works and undos and rollbacks the fired query.

1 Response
Add your response

Very good to know :)

over 1 year ago ·