• Resolved pinkpaisley

    (@pinkpaisley)


    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.

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

    (@owendevelopment)

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

    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.

    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

    (@pinkpaisley)

    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

    (@pinkpaisley)

    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.

    @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

    (@pinkpaisley)

    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.

    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?

    Thread Starter pinkpaisley

    (@pinkpaisley)

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

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

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

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

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Theme causing database connection error’ is closed to new replies.