mysql access loss

Last night from literally one moment to the next, one refresh of viewing my online webcalendar app to the next, my server's php applications lost their connection to all my sql databases. I can't connect through Navicat, and none of the database applications (gallery, forums, calendar, etc) can reach their databases.

I made zero changes. Wasn't even in the server by SSH or ftp. Just viewing the pages through firefox.

I booted into my backup copy of my linode server, and everything works perfectly. I have no idea what could have instantaneously changed in my primary server to kill the connection, and am having no luck restoring it.

Is there any solution I can try, so I don't have to roll back to a backup that isn't as current as I would like?

Thank you.

2 Replies

Did mysqld go down, perhaps? It's never happened to me AFAIK, but it's not beyond the realm of possibility.

You can manually check on your Linode whether your MySQL server is running and accepting connections using your webapp's credentials like so:

$ mysql --user=yourusername --pass=yourpassword
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.24a-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| foo                |
| test               |
+--------------------+
3 rows in set (0.10 sec)

Where yourusername and yourpassword can be found in your webapp's config somewhere.

The only other likely cause I can think of would be a firewall rule blocking access to port 3306. Possibly if you have some intrusion detection system set up, perhaps something set it off and caused it to block the port.

Check the syslog as well - on many distributions this is /var/log/syslog or /var/log/messages. The logs will provide clues as to whether an error of some sort caused mysql to crash. Alternatively it might shed light on a situation where for some reason MySQL has used up all its connections.

You could filter for mysql messages by running 'grep mysql /var/log/syslog' to strip out uninteresting messages about other services running on the server.

Otherwise you could just try and restart mysql or even reboot the machine rather than a restoration from backup which should be pretty last resort.

Reading logs is your friend, this sort of thing is what they're there for :)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct