WordPress Database Connection Error After Migration

Sharing my *moment* with WordPress and its dreaded "Error establishing a database connection" after updating the database.

Posted in Main Thread on March 30, 2011

I was migrating a WordPress database from Production to Staging the other day and received the dreaded “Error establishing a database connection” afterwards. I verified the database name, username, password, host, etc. Everything was correct. What the hell?

Then it hit me, we enabled multisite for this WordPress install. After looking under the hood, although WordPress could connect to the database, it didn’t find a matching entry for our staging URL. Apparently it still displays “Error establishing a database connection” message. A quick update to the records in the wp_blogs, wp_sites, and wp_options database tables resolved this.

Hope that helps someone. Check out my other post if you’re interested in setting up WordPress for multiple environments.

Find this interesting? Continue the conversation on Twitter or in a comment.

Need more? Let's team up!

Schedule 1-on-1 coaching or hire me for your project.

comments powered by Disqus