MySQL is supposed to allow one + the max_connections from a super user so you can stop/restartmysql even when it is reporting too many connections. Unfortunately, for reasons I'm not entirely sure of, sometimes that connection seems to be in use.

I've encountered this problem with web apps and now follow these steps:

  • Shutdown apache to prevent new connections
  • Search for and kill any backup processes (this can cause table locking which can be the cause of the problem)
  • Try a clean shutdown again
  • search for and kill mysqld_safe safe process on host. This step should kill one connection allowing you to cleanly stop mysql with:

/etc/init.d//mysql stop

Huh
I wonder why MySQL devs don't like unix signals.
Comment by Alan Sat 21 Jul 2012 04:32:19 PM EDT