I recently ran into a problem with MySQL where it wouldn’t start. As you can imagine, having a server and many websites that require MySQL, this was a big problem. The problem it kept reporting when I ran:
sudo service mysql status
was:
mysql stop/waiting
It took me a while to realize why it was happening. The result made me feel kind of silly, but now it’s a smart safety measure. I just wish that my logging would have been turned on!
Basically, I was working on adding some components to the server, and I wanted to monitor the logs that MySQL reported, so I changed the access rights to /etc/mysql/my.cnf, the configuration file for MySQL.
-rw-r–rw- 1 root root …. my.cnf
Turns out, I forgot to turn run the command:
sudo chmod o-w /etc/mysql/my.cnf
or
sudo chmod 644 /etc/mysql/my.cnf
Running this command makes my.cnf no longer writable to most of the world, and also allows MySQL to boot nicely.
One problem solved. Here I was having feverish thoughts my whole database would be lost and all my data since latest backup.
Needless to say, I’m backing up as I type.
Hope this helps!