We have recently upgraded our Ghost servers from 0.11.11 to 1.8.4 and our blogs started crashing randomly.

Since we installed Ghost using its CLI tool it was easy to see what el problema was by running: ghost ls to get the name of the blog and then ghost log blog_name to see that the error was ECONNREFUSED (I wish they would have come up with something better).

Unfortunately stabilizing MySQL on our tiny server was not simple and in fact the only thing that helped was a SWAP file.

Here is how to create it on Ubuntu (hosted by DigitalOcean, thanks to juanjo2988).

sudo dd if=/dev/zero of=/swap.dat bs=1024 count=512k
sudo mkswap /swap.dat
sudo swapon /swap.dat

and adding the following row to the fstab file:

sudo vi /etc/fstab

/swap.dat      none    swap    sw      0       0

To check that the file was create we can run: sudo swapon -s

An additional and in our case optional step would be to update MySQL config file (ususaly my.cnf) with innodb_buffer_pool_size=64M and reload it sudo service mysqld reload