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!

MAMP Pro – Access MySQL from another machine

To access MySQL that has been installed as part of MAMP:

1.  Click on FileEdit Template and then MySQLmy.cnfScreen Shot 2014-03-18 at 14.55.06

2. On line 37 (normally) you will see the bind-address = 127.0.0.1 (localhost) by default. Change this to: 0.0.0.0

Screen Shot 2014-03-18 at 14.55.50

3. Open phpMyAdmin on the local machine, click on the Users tab and then Add user

Screen Shot 2014-03-18 at 14.58.19

4. Enter details of the username and password. On the Database for user section choose Grant all privileges on wildcard name. Check all privileges for the user. (Ensure that Grant is ticked under Administration)

Screen Shot 2014-03-18 at 14.59.30

Click on Add user.

5. Restart the MAMP servers.

Server upgrade

I was finding that the server hosting my blog was running slowly, so the very nice people at Brinkster upgraded the site to a new faster server last night – to great effect 🙂

The blog now has a new faster MySQL database server as well – shame they wont support running it from Microsoft SQL Server – would work much better under load!