:::: MENU ::::

Error Establishing Database Connection on WordPress Login – Check Your Auth Settings

I recently downloaded a copy of my wordpress site to my local dev machine using the Duplicator plugin (works great by the way), and everything seemed to be working correctly, until I went to the wp-admin page. When trying to login via wp-admin I was presented with the message “Error establishing database connection.” Like most relatively intelligent individuals, I cracked open my wp-config file and checked, then re-checked, then re-re-checked my DB_USER, DB_PASSWORD, DB_HOST, and DB_NAME properties. As far as I could see they were all correct, yet the issue remained.

After a bit of poking around, I tried removing the “Authentication Unique Keys and Salts” section (the lines that define the keys and salts), saved the file out, and refreshed my wp-admin page. Voila! The login screen was presented as expected and I was able to successfully access my dashboard. Next, I added the keys and salts section back into wp-config, and re-saved the file. I feared this would re-introduce the isssue; however, it did not!

I’m not 100% sure on why this worked, but from the little bit of reading I did on the Authentication Unique Keys and Salts, it seems that pulling these out may have cleared out my user cookies, and forced a new cookie to be established which somehow resolved the database connectivity issue. I’m sure there’s a much better explanation to be had, but for now I’ve got work to do…

So, what do you think ?