Title: Persistent Database Connection Error
Last modified: December 11, 2018

---

# Persistent Database Connection Error

 *  [errorslayer](https://wordpress.org/support/users/errorslayer/)
 * (@errorslayer)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/persistent-database-connection-error/)
 * Hi,
 * I’m not sure if this is the right place to post this so feel free to move!
 * I’ve been getting a persistent ‘error establishing a database connection’ error.
   The error only occurs when I make changes to a page and then try to update it.
   It lasts for only a few seconds (maybe 30 max) and then stops and I can visit
   my site as normal. It also doesn’t occur every single time that I try to update
   a page; it only happens randomly and I’ve been unable to reliably replicate it.
 * Here’s what I’ve tried to fix it:
 * -Optimizing/repairing the database
    -Verifying login credentials in wp-config.
   php -Painstakingly testing each plugin one by one multiple times -Enabling the
   error log -Contacting my host multiple times
 * The error log only showed 3 messages, all of which related to plugins. I tried
   disabling 2 of the plugins and the error persisted.
 * The third error message was this:
 * Notice: Undefined variable: parent_style in /home/x/public_html/wp-content/themes/
   NepalBuzz-Child/functions.php on line 13
 * I used a child theme plugin to create my current theme so I’m not sure how I 
   would even go about fixing this error. Still, I don’t believe that this error
   is causing the issue because I’ve been using this theme since the very beginning
   of my site and never had any problems up until now.
 * When I contacted my hosting service they ultimately told me that the error was
   happening because we were using too much disk space and our site wasn’t optimized.
   I did a ton of work on our site analyzing pages using GMetrix to optimize them(
   I haven’t had a chance to do every single page yet since I’ve been busy working
   on other things, but I made a dent), installed a cache plugin that increased 
   our site’s speed by a lot, and also deleted a bunch of unneeded files from cpanel.
   This seemed to help for a while, but the database connection error came back.
 * Is my hosting service right? Is it possible that this error is because we’re 
   using up too much space/our site isn’t optimized? What can I do to resolve this?
   I deleted as many unnecessary files as I could and I’m going to go back to work
   on optimizing more pages (unfortunately I can’t really delete any plugins because
   we need all the ones we’re currently using). It just seems strange that this 
   would cause a database connection error, especially since I’ve Googled this issue
   multiple times and followed many guides trying to resolve this error, and none
   of them mentioned this as a possible cause. Then again, I’m not a developer so
   I could be wrong.
 * Any help/advice on fixing this issue once and for all would be very much appreciated!
   Thank you!
    -  This topic was modified 7 years, 5 months ago by [errorslayer](https://wordpress.org/support/users/errorslayer/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [7 years, 5 months ago](https://wordpress.org/support/topic/persistent-database-connection-error/#post-10974279)
 * > I’m not sure if this is the right place to post this so feel free to move!
 * Moved to Fixing WordPress, this is not an Everything else WordPress topic.
 * > When I contacted my hosting service they ultimately told me that the error 
   > was happening because we were using too much disk space and our site wasn’t
   > optimized.
 * I think you need a new host provider. The host plan that you’re using may be 
   too lightweight. That error happening that frequently means the mysql database
   is coping badly with your load.
 * You can try a caching plugin that’s based on creating static files for your unchanged
   content. WP Super Cache does that, there are others.
 * [https://wordpress.org/plugins/search/cache/](https://wordpress.org/plugins/search/cache/)
 * Essentially your WordPress site is trying to connect to your database server 
   and it’s not picking up the phone. By adding a caching plugin that should keep
   the queries down and lessen the load to your DB.
 *  Thread Starter [errorslayer](https://wordpress.org/support/users/errorslayer/)
 * (@errorslayer)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/persistent-database-connection-error/#post-10979297)
 * Hi,
 * Thank you! Unfortunately I’ve already been using WP Super Cache for a while now
   and although it’s definitely helped in some aspects, the error persists.
 * I will definitely look into a new host provider. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Persistent Database Connection Error’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [errorslayer](https://wordpress.org/support/users/errorslayer/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/persistent-database-connection-error/#post-10979297)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
