How to Rescue your WordPress Site – Error Establishing Database Connection

I find that when serving a WordPress site on a VPS with 256MB RAM or less, the following error tends to occur.

Having bumped into this situation several times, I can now come to the conclusion that in most the cases this problem can be resolved simply by restarting the database, in my case, MySQL database.

So with the following command:

$ service mysql start

But in some situations, you may be unfortunate to have this situation.

This is a case that I haven’t solved. I guess that the problem is still that the memory is not enough but more severely, not enough for it to start up again.

I think this gives us a moral that it is a good practice to always run your WordPress Server on a VPS with at least 512MB RAM.