I host a roundcube installation as well as YOURLS, which both make use of MySQL databases. Everything worked very fine, up until yesterday evening; MySQL decided it was time to make a mess of things and refused to work! Since I host two of my websites on the same VPS, using the same MySQL installation, they both stopped working at once.
The errors I get on my websites are as follows:
Roundcube website: DATABASE ERROR: CONNECTION FAILED! Unable to connect to database.
YOURLS website: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
The YOURLS error gave more insight into my problem, so I googled MySQL socket error and got a few interesting suggestions. On Stack Overflow, they suggested to chmod 777 the mysql socket, add socket=/var/lib/mysql/mysql.sock to my.cnf, but none of this helps. However, one peculiarity I found is that MySQL starts working again after I restart it. Hmm, very strange. I’ll try and reinstall it, after all, and see what comes of it.
Please help, if you know how to solve this problem. Thank you!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This happend to 2 of my droplets too (yesterday evening)! How to fix it? I don’t think that adding a swap file will help.
I have the same problem in one of my droplet. I did a full update of the packages in my system. the mysql is up and running now.
sudo apt-get upgrade
It looks like MySQL crashed. That usually happens when your droplet runs our of memory.
Try adding a swap file to your droplet: How To Add Swap on Ubuntu 14.04 | DigitalOcean.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.