WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Theme causing database connection error (13 posts)

  1. pinkpaisley
    Member
    Posted 1 year ago #

    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.

  2. Phil
    Member
    Posted 1 year ago #

    Check the theme functions.php file just to check if there is any override to database.

  3. jgarcia439
    Member
    Posted 1 year ago #

    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.

  4. 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.

  5. pinkpaisley
    Member
    Posted 1 year ago #

    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.

  6. pinkpaisley
    Member
    Posted 1 year ago #

    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.

  7. adewalelagos
    Member
    Posted 1 year ago #

    @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.

  8. pinkpaisley
    Member
    Posted 1 year ago #

    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.

  9. adewalelagos
    Member
    Posted 1 year ago #

    Thanks @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?

  10. pinkpaisley
    Member
    Posted 1 year ago #

    Do you have the WP Super Cache or any other caching plugin? And did you clear your own cache?

  11. adewalelagos
    Member
    Posted 1 year ago #

    I have W3 total cache installed and i clear it regularly.

  12. bell.igsoft
    Member
    Posted 1 year ago #

    I have also the same problem at time createing a multi site in wp. Kindly help how fix the Error establishing a database connection..

  13. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    As per the Forum Welcome, please post your own topic.

Topic Closed

This topic has been closed to new replies.

About this Topic