Serving The Planet

WordPress: Error establishing database connection when accessing wp-login.php (+ uncommon solution)

WOW … I’ve spend 6 hours(!) on fixing an interesting WordPress problem. The frontend of the site worked … but we couldn’t login into the backend, getting the “Error establish database connection”.


Troubleshooting:

  • all directory rights and ownership were correct
  • database settings in wp-config.php were correct
  • php database testscript showed database connection could be made
  • some strange caching settings, where the entire site didn’t seem to be parsed from the database but the cache, implying again no database connection could be made.
  • owner of some cache files were apache:apache, after correction to right ownership problems still emerged
  • mod_rewrite settings in .htaccess files seemed correct
  • phpinfo() values were correct (with regards to phpsafe “off” settings)
Solution … login into db admin / phpMyAdmin, go to the table wpoptions. option_value 1 and 39 have to mention the site. Option 39 “home” was present, option 1 “siteurl” wasn’t present. Reinsert the value, and both frontend and backend were working again like a charm!
Cause? Unknown. Maybe site hacked? Additional advise: change all passwords.
A bunch of resources used:
Did you enjoy this article?
Signup today and receive free updates straight in your inbox. We will never share or sell your email address.
I agree to have my personal information transfered to GetResponse ( more information )

About Earnie Rhyker

tech pioneer | intellectual BadAss | ethical lifehacker | WordPress Developer & Polyglot | information activist | blogger | added value services provider | multimedia enthusiast | senior linux server administrator | geek | bitcoin investor | laptop entrepreneur | open source contributor | hackintosh fanatic | charity donator | accredited top MLM networker & internet marketer 2014-2016 @ BFH | digital expat

Visit My Website
View All Posts
Earn With Earnie
error: Content is DCMA protected !!
Home of Digital Assets Manager & Nomad: Earnie Rhyker
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.