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

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 127.0.0.1:3306 (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

Plate of sushi rolls on a table


For more context on why this blog eventually moved away from Ghost entirely, see Ghost: why this blog no longer runs on it.

Welcome to The infinite monkey theorem

Somewhere a monkey just typed Shakespeare in TypeScript. Be the first to read the masterpieces (and the hilarious misfires) landing on the blog.

Subscribe to The infinite monkey theorem

We fling fresh posts—no banana peels attached—straight to your inbox.