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:

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

View All Posts

Communities I have been 'hanging out' regularly over the past two decades. 

Note: links go to my profile on those respective sites. Connect with me if you like.

 

Earn With Earnie

This site hasn't been updated since 2022. Visit my new blog -- EarnWithEarnie.com -- instead:

X
error: Content is DCMA protected !!