By WASTECH
So this is a very odd issue that I can not seem to find an answer to anywhere else, but is causing me a huge problem.
So I am working on a website for a friend and I set him up with a digital ocean droplet running Wordpress (using the one click install). The server was fine for about a week, but then I would start to get the “Error establishing a database connection” message when trying to load the site. I eventually figured out that it was because MySQL was no longer running. I started the service again, thinking nothing of it and went about my day. I check back later, same error. I once again restart MySQL but watch htop this time. I see my RAM usage skyrocket, followed by my CUP usage, then it all goes back down and MySQL has crashed again. I ask another friend who has much more experience than me and he recommended rebuilding the droplet. Exported MySQL databases and backed up Wordpress files, rebuilt, imported settings, and was fine for a few days, but today I noticed the issue is happening again, but slightly different this time. Last time, MySQL lasted a good two minuted before crashing, now it seems to be about an hour between crashes, and in-between those times, CPU and RAM usage is normal and steady. I can guarantee you this isn’t a problem with the server being overloaded from a large amount of traffic, there are only about 10 people who know the site exists and there have only been about 24k requests since the site went active on May 5th (a majority of them being me). I have tried to solve this on my own but have had no luck at all, this is getting to be very frustrating.
To add some more information, before MySQL crashes, it starts creating new process that I can see from htop, but never ends them. I can run Apache2 just fine without MySQL and I can run MySQL just fine without Apache2 and there is no issue, but when the two are running at the same time, MySQL crashes. Here is my Apache2 config file. If there is anything else you need, let me know and I will get it for you as soon as I can.
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!
What about your logs? Did you check the log of mysql? Maybe Apache2 floads the mysql DB with requests? Also just to be sure check your apache2 log. And what is the last thing you changed before this problem started? Maybe you installed a plugin?
You could run these(as seperate commands):
- tail -30 /var/log/mysql.err
- tail -30 /var/log/mysql.log
- tail /var/log/mysql.log
- tail -30 /var/log/apache2/error.log
Well, to anyone coming here that has the same problem, I was unfortunately unable to solve it. I have now moved from Apache to Nginx. It only took me about 20 minutes to move and everything is working beautifully. Here is the wonderful guide I followed to transfer everything over.
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.