• Hey everyone, it’s been just about a year that I’ve gone to a new theme on WordPress. Prior to that, I never experienced the dreaded ‘Error establishing a database connection.’ Now, the error seems to pop up here and there and when the error happens, it could can happen a 100 times that day. The error takes place inside of WP Admin, on the site itself and when readers visit.

    I’m curious as to the cause of it. Could the theme be causing such an error or is it the many other potential readers that other threads have discovered (though none seem like a sure answer).

    The site in question is https://www.sonyrumors.net

Viewing 5 replies - 1 through 5 (of 5 total)
  • Could the theme be causing such an error

    No. It’s far more likely that the server you are using is now over-loaded. Try speaking to your hosts about this.

    Thread Starter illegalprelude

    (@illegalprelude)

    No. It’s far more likely that the server you are using is now over-loaded. Try speaking to your hosts about this.

    Hey esmi, thanks for the quick response. I use Bluehost as my host so should I be investigating anything particular? The site isn’t hitting any kind of peak traffic so that cannot be the cause of it. I’ve had the site have triple the traffic in a day and not receive an error.

    However, if you believe that it can be caused by an overload which is probable, where/what should I be looking/asking for?

    should I be investigating anything particular?

    I’d suggest recording the dates & times that these errors occur or a few days and then sending the evidence to Bluehost and ask them to investigate it. If you are on a shared server, it could be that another site on the server is hogging all of the resources. Your “error log” should help Bluehost to track the problem down.

    If your theme creates processes that run a long period of time, or if it makes connections to the database and doesn’t close them properly, etc., it could actually cause some backing up which could cause temporary failures to connect to the database, more especially if it is causing you to reach your max connections.

    If this just started when you switched themes, it seems logical that there would be something theme-related in some way. You may want to try a different theme for a while and see if you still experience the problems.

    If you don’t have a caching plugin, try installing one of those too, to help minimize processes/connections, depending on how your theme works.

    Still have the server checked and check your error_logs, etc., though of course.

    Thread Starter illegalprelude

    (@illegalprelude)

    I noticed I’m getting quite a bit of this in MySQL logs:

    /home7/sonyrumo/tmp/mysql_slow_queries/20120217-15.log
    # Fri Feb 17 15:58:27 2012
    # Query_time: 3.432624 Lock_time: 0.001020 Rows_sent: 16 Rows_examined: 80
    use sonyrumo_wrd1;
    SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (‘category’, ‘post_tag’, ‘post_format’, ‘author’) AND tr.object_id IN (3009) ORDER BY t.name ASC

    With query times over 2 seconds. Could this be the cause?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Error establishing a database connection due to theme?’ is closed to new replies.