OK I get this about three weeks or so on our new DigitalOcean Droplet running WordPress. The good news is the JetPack does inform you when it dies.
If you have your WordPress created with the one-click Droplet under DigitalOcean it works great except that there is no swapfile, so with a 1GB RAM server that $5 buys you, you can have Mysql run out of memory. The longer term solution is to upsize the RAM, but this is a case where you really do want a Swapfile. Even with a 25GB SD, having a 2GB swapfile should solve lots of problems and it is four lines to add.
On Bluehost, this basically has never happened. A restart of the droplet seems to help, but it would be good to figure out what is going on.
This is a very common problem and WP Beginner has a diagnostic set.
- See if your host is up. A quick ssh can check to make sure the Droplet is still running.
- Does the problem occur with the administrative interface
/wp-admin/. If it says the database needs to be repaired, then you can add
wp-config.phpand you can fix it and then go to
- Check your WP-Config.php file and if you didn’t change your database password (why would you?), then you make need to change the DB_Host from localhost to
define('DB_HOST', '127.0.0.1:8889but this didn’t work either. Or try 3306
- See if MySQL Server is up and running. You need a sample application that tests this.
'Could not connect: '
?> If this ends with could not connect then MySQL is down for some reason.
How to debug Mysql
OK, so that wasn’t of much help, time to figure out what to do when Mysql is unavailable. DigitalOcean has a good tutorial on this:
- Look at the error log, they are kept in
var/log/mysql/error.logand it was pretty revealing, the last line was
/usr/sbin/mysqld: Shutdown complete
- Looking up it says,
Failed to initialize builtin pluginsand then it shows that InnoDB failed because it could not allocate buffer memory.
So I”m wondering if my 1GB tiny WordPress Droplet is too small and StackOverflow confirms that it will not run in a $5/month droplet because of memory shortages. You need more RAM and you should allocate a Block Volume.
To test this, you can just restart Mysql with
service mysql restart and see if it works It won’t tell you what is really wrong, but will get you going again.
No Swapfile for WordPress Droplet installations
Ok, part of the problem seems to be that there is no swapfile for the DigitalOcean droplet. That is
swapon -s reveals nothing and there is no
If you already have a swapfile, here is how to increase the size, first turn off the swap and then first disable the swapfile and delete. See https://askubuntu.com/questions/1075505/how-do-i-increase-swapfile-in-ubuntu-18-04
sudo swapoff /swapfile
sudo rm /swapfile
The other thing it could be is that Apache is overloading because of too much access to XMLRPC, but that doesn’t seem like the problem. With Ubuntu 18.04, a swapfile can be just about anything, but by convention,
/swapfile is used, so to create one, it looks like to create a 2GB swapfile
dd if=/dev/zero of=/swapfile count=2K bs=1M
sudo chown root:root /swapfile
sudo chmod 600 /swapfile
sudo swapon /swapfile