MySQL and Apache2 running together crashes MySQL

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.


I forgot the include the link to my Apache config. Here it is.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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):

  1. tail -30 /var/log/mysql.err
  2. tail -30 /var/log/mysql.log
  3. tail /var/log/mysql.log
  4. 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.