MySQL stops accepting connections over 3306, still working on localhost
- by Ben Dilts
I have a MySQL database that stopped accepting connections from my web server altogether. So I SSH'ed into the server and started checking its vitals. The hard disks had plenty of open space, and there was plenty of available memory and swap space. Nothing was eating up the CPU (close to 100% idle). I even connected to MySQL locally and ran a few queries without any issues. But SHOW PROCESSLIST only showed my own connection, no others.
Worst of all, in the MySQL log, no errors even remotely coincided with the unavailability of the server.
On the web server, I got an error saying "Lost connection to MySQL server during query" at the moment the unavailability started, followed by a bunch of "MySQL server has gone away" errors.
There's only one other application on the server that accepts network connections, and I killed that one (in case it was holding too many open connections or something), but it didn't help.
Finally I just restarted the MySQL process, and everything is (for now) working again.
What else should I check in these circumstances? Any idea what the problem might be? And how might I verify that is in fact the problem?