Title: Theme causing database connection error
Last modified: August 20, 2016

---

# Theme causing database connection error

 *  Resolved [pinkpaisley](https://wordpress.org/support/users/pinkpaisley/)
 * (@pinkpaisley)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/)
 * Since I upgraded my WordPress install a while ago (previous upgrade, not the 
   latest one), I’ve been getting the ‘Error establishing a database connection’
   error in both the frond-end and the back-end.
 * – I’m using a personalized version of the Boilerplate theme.
    – I’m 100% certain
   it’s not a plugin, because I’ve disabled them all and tested in multiple browsers
   to avoid caching. – Repaired and optimized all databases – Changing my theme 
   to the WP Twenty Twelve theme stopped the time-outs. But I need my current theme
   to work. – I’ve debugged the site and haven’t found anything that could cause
   it.
 * Does anyone have any clue as to what could be causing this? Before I build a 
   new theme, I want to make sure I’m not missing anything.
 * Site can be found [here](http://paulleim.com).

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

 *  [Phil](https://wordpress.org/support/users/owendevelopment/)
 * (@owendevelopment)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413238)
 * Check the theme functions.php file just to check if there is any override to 
   database.
 *  [jgarcia439](https://wordpress.org/support/users/jgarcia439/)
 * (@jgarcia439)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413306)
 * Check the database that you have on your server. The password of that user of
   database must match with the password that you have on wp-config.php file on 
   your wordpress.
 *  [Mark Ratledge](https://wordpress.org/support/users/songdogtech/)
 * (@songdogtech)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413309)
 * > I’ve been getting the ‘Error establishing a database connection’ error in both
   > the frond-end and the back-end
 * Is the error all the time or intermittent? If intermittent, talk to hostgator,
   it’s their problem; if all the time, wp-config.php got deleted or some values
   changed in the file or at Hostgator.
 *  Thread Starter [pinkpaisley](https://wordpress.org/support/users/pinkpaisley/)
 * (@pinkpaisley)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413332)
 * > Check the theme functions.php file just to check if there is any override to
   > database.
 * What am I looking for exactly?
 * > Is the error all the time or intermittent?
 * Intermittent. MySQL panel is extremely slow for me too. The data in wp-config.
   php is correct.
 *  Thread Starter [pinkpaisley](https://wordpress.org/support/users/pinkpaisley/)
 * (@pinkpaisley)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413451)
 * Turns out there was a cron job triggered every time a user visited the page, 
   so this caused the time-outs. Creating a cron job myself and disabling cron job
   in wp-config fixed this. To be sure I also disabled WP Super Cache and this fixed
   the issue.
 *  [adewalelagos](https://wordpress.org/support/users/adewalelagos/)
 * (@adewalelagos)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413489)
 * [@pinkpaisley](https://wordpress.org/support/users/pinkpaisley/), my situation
   is exactly thesame as yours, when i switched to 2012 theme my site works very
   fine and when i switch back i get the error. would you mind sharing with me how
   to create cron job and to disable the one in the wp-config file. am hosted on
   bluehost and i know how to find my way around the cpanel.
 * Thanks.
 *  Thread Starter [pinkpaisley](https://wordpress.org/support/users/pinkpaisley/)
 * (@pinkpaisley)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413491)
 * Just add this to your wp-config file
 * `define('DISABLE_WP_CRON', true)`
 * How to manually add a cron job differs per host. I would check with Bluehost 
   to see if they can tell you how to do it.
 *  [adewalelagos](https://wordpress.org/support/users/adewalelagos/)
 * (@adewalelagos)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413499)
 * Thanks [@pinkpaisley](https://wordpress.org/support/users/pinkpaisley/), i added
   the code above to my wp-config file and i set cron job to every 30 minutes but
   i still get the error, mostly when am logged in as admin. What else will you 
   suggest i do?
 *  Thread Starter [pinkpaisley](https://wordpress.org/support/users/pinkpaisley/)
 * (@pinkpaisley)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413500)
 * Do you have the WP Super Cache or any other caching plugin? And did you clear
   your own cache?
 *  [adewalelagos](https://wordpress.org/support/users/adewalelagos/)
 * (@adewalelagos)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413501)
 * I have W3 total cache installed and i clear it regularly.
 *  [bell.igsoft](https://wordpress.org/support/users/belligsoft/)
 * (@belligsoft)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413518)
 * I have also the same problem at time createing a multi site in wp. Kindly help
   how fix the **Error establishing a database connection.**.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413519)
 * As per the [Forum Welcome](http://codex.wordpress.org/Forum_Welcome#Where_To_Post),
   please [post your own topic](http://wordpress.org/support/forum/how-to-and-troubleshooting#postform).

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

The topic ‘Theme causing database connection error’ is closed to new replies.

## Tags

 * [Error establishing a database connection](https://wordpress.org/support/topic-tag/error-establishing-a-database-connection/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 12 replies
 * 7 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/theme-causing-database-connection-error/#post-3413519)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
