Title: Persistent &#8220;Error Establishing Database Connection&#8221; When DB OK
Last modified: December 10, 2016

---

# Persistent “Error Establishing Database Connection” When DB OK

 *  [Nabsta](https://wordpress.org/support/users/nabsta/)
 * (@nabsta)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/persistent-error-establishing-database-connection-when-db-ok/)
 * _[ Moderator note: [moved to How-to and Troubleshooting](https://wordpress.org/support/topic/wheres-my-topic-gone?replies=1&view=all).]_
 * Hi,
 * Tearing my hair out here. Website seeva.com.au. Under development so I don’t 
   want to lose a week’s work!
 * Sequence of events:
    - Saw the update notification to WordPress 4.7;
    - Backed up everything (WordPress and database) using Updraft Plus;
    - Installed the updates – WP, themes (inc. Divi), plugins (BTW I use a child
      theme);
    - Then noticed that the Divi Child theme was showing an error in being unable
      to find the style.css template even though I hadn’t changed anything;
    - Tried to fix the Child theme but WordPress wasn’t even recognising it;
    - Decided to restore to the back-up taken just before the update;
    - After the restore it was saying that the WordPress DB was needing repair;
    - Repair function stated that all the tables were OK and to remove the above
      parameter;
    - Did the same from phpmyadmin but of course InnoDB doesn’t allow for repair,
      but the check function worked fine;
    - I uploaded a fresh version of WordPress 4.7 less wp-config.php and wp-content;
    - Reinstated wp-content and wp-config;
    - Checked permissions on the base files and folders;
    - Renamed plugin and theme directory to deactivate;
    - Used a test script to check the db connection and no probs ([https://gist.github.com/sivel/162913](https://gist.github.com/sivel/162913)).
 * Please help.
 * Regards
    David

Viewing 1 replies (of 1 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/persistent-error-establishing-database-connection-when-db-ok/#post-8537032)
 * – “Error establishing a database connection” means that there is a problem with
   the connection to your database
    – a problem with the credentials stored in the
   wp-config.php file not matching what mysql expects. – Try reviewing the following
   codex for some guidance: [http://codex.wordpress.org/Common_WordPress_Errors#Error_Establishing_Database_Connection](http://codex.wordpress.org/Common_WordPress_Errors#Error_Establishing_Database_Connection)
 * If all that info is correct, then try:
    – Flushing any caching plugins you might
   be running, as well as server and/or [browser caches](http://www.refreshyourcache.com/).
   Not just your browser, but any op cache or content network cache as well [such as Cloudflare](https://support.cloudflare.com/hc/en-us/articles/200169246-How-do-I-purge-my-cache-).
   If your host provider has a “Purge Varnish” option or if you can ask your provider
   to flush memcache on your server. – If that does not resolve the issue, try deactivating
   ALL (yes all) plugins temporarily to see if this resolves the problem (plugin
   functions can interfere). If this works, re-activate them individually (one-by-
   one) to find the problematic plugin(s). – If that does not resolve the issue,
   or if you can’t get into your admin dashboard, try [resetting the plugins folder](http://codex.wordpress.org/FAQ_Troubleshooting#How_to_deactivate_all_plugins_when_not_able_to_access_the_administrative_menus.3F)
   by [FTP](http://codex.wordpress.org/FTP_Clients). Sometimes, an apparently inactive
   plugin can still cause problems. Also remember to deactivate any plugins in the
   mu-plugins folder (if you have created such folder). The easiest way is to rename
   that folder to mu-plugins-old. – If that does not resolve the issue, keep all
   plugins deactivated and try switching to the unedited default Theme (Twenty Seventeen)
   for a moment using the WP dashboard to rule out any theme-specific issue (theme
   functions can interfere like plugins). If you don’t have access to your admin
   area, use [FTP ](http://codex.wordpress.org/FTP_Clients), or your web-host’s 
   cPanel or whatever file management application your host provides (no Dashboard
   access required). Navigate to /wp-content/themes/ and switch to the default theme
   by renaming your current theme’s folder by adding “-old” to the end of the folder
   name. Alternately, you can remove other themes except the default theme. That
   will force your site to use it. – If all the above steps do not resolve the issue,
   then try **MANUALLY** updating. Download a fresh copy of the WordPress .zip file
   to your computer, unzip it, and use that to copy up all files and folders **EXCEPT
   the wp-config.php file and the /wp-content/ directory.** You may need to delete
   the old wp-admin and wp-includes folders and files on your server before uploading
   the new ones. Please read the [Manual Update](http://codex.wordpress.org/Updating_WordPress#Manual_Update)
   directions first. – **Backup: If you haven’t already done, always backup everything(
   including your database) before doing any actions, just in case something really
   goes wrong. You can never have enough backups! **
    -  This reply was modified 9 years, 5 months ago by [t-p](https://wordpress.org/support/users/t-p/).
    -  This reply was modified 9 years, 5 months ago by [bdbrown](https://wordpress.org/support/users/bdbrown/).

Viewing 1 replies (of 1 total)

The topic ‘Persistent “Error Establishing Database Connection” When DB OK’ is closed
to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/persistent-error-establishing-database-connection-when-db-ok/#post-8537032)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
