Database Connection Error With Wordpress on Ubuntu 12.10

Posted September 26, 2013 6.6k views
Hi, I install one click install wordpress on ubuntu 12.10. Then setup correctly and route my domain to vps. After that I backup my old wordpress db and import into vps. It worked. But When I publish a post, after 5 minutes, my blog doesnt open and give error like database connection error. If I restart mysql service by putty, my blog comes again. What is the problem with it? Everytime I have to restart mysql service.

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.

Submit an Answer
8 answers
How much RAM does your droplet have?
Why? Because that may be the culprit.

Try adding swap: How To Add Swap on Ubuntu 12.04 & memcache: How To Install and Use Memcache on Ubuntu 12.04.

Apache can eat up a lot of server resources, as well. If you're using Apache, you're probably better off with Nginx. See How To Install Wordpress, Nginx, PHP, and Varnish on Ubuntu 12.04.
I don't think so, I have 100 user/day avarage. 512 mb doesn't enough for that ?
Users per day is not the only variable that dictates whether 512MB is enough. The amount of dynamic vs. static content & database size also play a role.
Ok, I got it, thanks for information.
Ive got the same problem, did it that fix it for you?
@jmcornejo00: Try adding swap to your droplet as Pablo suggested:

That should fix it most of the times.