WordPress Database Connection Error After Migration
Main Thread • 1 min read
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? Let's continue the conversation on Twitter.