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.
Written by Anupama Aggarwal
Related protips
1 Response
Very good to know :)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mysql
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#