WordPress: The Dreaded “Error Establishing Database Connection” message

My site has just been down for more than 24 hours due to a wordpress update, that in its wisdom the plugin developer assumed that the version of MySQL would be an older version, and corrupted the WordPress database that the site uses.

I’ve recovered the site from last nights backup, and thankfully there has been no data loss, but its still a timely reminder as to the importance of regular backups of both files and the database of even a small WordPress site.

Needless to say, panic averted, and automatic plugin updates are now turned off!

Ubuntu – Backup Amazon EC2 to S3 (Pre-requisites)

Pre-requisites on the server are Amazon S3 tools, and zip

sudo apt-get install s3cmd

sudo apt-get install zip unzip

You then need to configure the s3cmd to use the Access Code and Secret Key from the IAM within your AWS console. Its recommended that you set up a new user with programmatic access only for each server / project, and give the user the AmazonS3FullAccess permission.

Back on the server, run
sudo s3cmd --configure
Enter your access key, secret key

If, like me you are using EU-West-1 (Dublin) as your datacenter, then type in “eu-west-1” for the Default Region.

Enter a password to encrypt traffic between the EC2 instance and S3 (DO NOT USE YOUR MAIN ACCOUNT PASSWORD, MAKE A NEW ONE)

Path to GPG program – just press Enter

Use HTTPS – Yes

HTTP Proxy – leave blank, just press Enter

Test – Yes