When MySQL Just Won’t Stop!

Last night I was running a big import on an Azure VM and thought that my shutdown at 11pm would give it enough time. I was wrong 🙂 Sadly, when I came in the next day, the database I’d been importing into was in an unstable state and my attempt to drop the database led to a loooooong wait that just didn’t seem to ever want to finish. Fortunately, if that happens to you, or something like it, there is something you can do about it.

Firstly, let’s take a look at what processes are running. Connect to your MySQL database and run this command:

I’ve done some careful editing here, but you can see that we have 5 processes and process Id 10 is the command I had just run. 7, 8 and 9 were all waiting for…you guessed it, Id number 5.

That one was complaining about repairing (good grief, what had I done?) so the only humane thing I could do was to open a new terminal and type:

On UNIX, killing processes is usually super fast, but I found that I needed to re-run my command to show the processes a few times in MySQL to see anything other than the process was supposedly ‘killed’. This may be because rather than a kill -KILL process-id it might be more like kill -SIGTERM process-id. If that means nothing to you, think of it as a brutal murder spree in Call of Duty compared to an act of mercy.

After about a minute (your mileage may vary), everything cleaned up and the problem was resolved. Phew.

 

 

twittergoogle_plusredditpinteresttumblrmail

Written by Stephen Moon
email: stephen at logicalmoon.com
www: https://www.logicalmoon.com


Leave a Reply

Your email address will not be published. Required fields are marked *