I am running WordPress on AWS (Ubuntu). and have a very weird issue, every few days the database crashes and I am getting the “Error establishing a database connection” message. When I restart it with
sudo service mysql restart
Everything works fine, until the next time it happens several days later.
Any idea what is going wrong?
Thanks
Are you using micro instance? If so, then you are probably running out of memory.
The workaround is to create a swap as a file.
This are the steps to do that:
Now edit /etc/fstab file, so that when you restart the system, swap can be mounted automaticaly.
And add this in the file:
To get better performance from swap file in AWS you need to do this too: