error when etablishing database connection is a common error

April 8, 2015 660 views


I have just got my website moved to DigitalOcean. Before there was never a problem when "error when etablishing database connection is a common error" but now it comes more times a day.

My CMS is Wordpress. Do you have any idea why?

One hav told me it takes 48 hours before all DNS is working perfectly - is that correct? Because sometimes it works fine.



1 comment
  • A programmeur I know have just told me that the database tables crashed for some reason. But he don't know why - any ideas?

2 Answers

This is not an uncommon issue when running WordPress on a 512MB or 1GB droplet. What happens is that the MySQL process allocates memory for itself and on these smaller droplets it can run out of physical memory.

Generally a Linux server will have a swap partition which is used to supplement the RAM but there is no swap partition by default on a droplet.

This issue can almost always be resolved by creating and enabling a swap file on your droplet.

This does not sound like it is at all related to your DNS change. DNS issues would result in your droplet not being reachable at all and since it is returning the database error page your web server is being reached.

by Justin Ellingwood
Swap space can be used as an "overflow" area for your system when you run out of RAM. The operating system can store data that would normally be kept in RAM on the hard drive in a specially formatted file. In this guide, we'll demonstrate how to create and use one of these files in Ubuntu 14.04.

Thank you for the answer! I will see if I can get someone to help me with it.

Would you advice me to get the bigger solution with 2 core and 2 GB ram?
Yesterday was a normal day in visits - the graph are from the last 24 hours.

Have another answer? Share your knowledge.