Adding more memory to linux server

June 30, 2014 3.7k views

Recently I've had mysql crash on my wordpress site multiple times, giving me the "error establishing connection to database" error.

I have a 1gb droplet and I think the problem might be low memory on my linux server. How can I fix this problem so that I don't run out of memory?

1 Answer

Try adding swap to your droplet: How To Add Swap on Ubuntu 12.04.

If that doesn't fix it, you might want to consider upgrading your droplet as it's running out of memory or switching from Apache to nginx.

by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on Ubuntu 12.04
  • Hey Kamal,

    If I were to upgrade my droplet (I'm already at 1gb), would that definitely fix the problem? I don't particularly care about paying more but I just can't imagine that my relatively simple wordpress site (with a small database of maybe 4000 datapoints) could be that memory-intensive.

  • Running out of memory is most likely why MySQL is crashing, so adding more RAM to your droplet should fix the problem. You can make sure that's the case by checking MySQL's error log for details on why it's crashing:

    sudo tail -40 /var/log/mysql.err
Have another answer? Share your knowledge.