Support » Fixing WordPress » Error connecting to database

  • WordPress suddenly start responding with Error connecting to database. web page does not respond. I have checked connection to database, rights and setting in wp-config.php. They are all right.

    Running on:
    Opensuse 12.1
    apache2 ver 2.2.21
    php 5.3
    mysql 5.5

    Any hint?
    Thank you, Andre

Viewing 2 replies - 1 through 2 (of 2 total)
  • I got the same problem then I contact with my hosting provider and fix it by killing all sleep connection. And now again same problem. Here is the response I get from hosting provider.

    The problems are due to sleeping/hung database connections.

    At this time the MySQL max_user_connections setting is set to 20, meaning that an individual CPanel user can have up to 20 separate database connections at any given time.

    For some reason certain connections you are making to your WordPress database are failing to close and are ‘sleeping’ for extended periods. These sleeping processes are collecting up and once they reach 20 the web site can no longer connect to the database.

    Here is a list of the 20 processes I just killed in order to get WordPress back up and running:

    | 270285 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 25943 |
    | 271946 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 25543 |
    | 278034 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 23781 |
    | 278428 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 23647 |
    | 281686 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 22569 |
    | 281688 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 22568 |
    | 282325 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 22435 |
    | 282611 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 22364 |
    | 282715 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 22332 |
    | 283335 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 22182 |
    | 284477 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21778 |
    | 285203 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21586 |
    | 285206 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21586 |
    | 285448 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21518 |
    | 285679 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21446 |
    | 286170 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21292 |
    | 286264 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21266 |
    | 286886 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21124 |
    | 287036 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 21070 |
    | 291090 | [DATABASE NAME] | localhost | [DATABASE NAME] | Sleep | 20141 |

    As you can see these processes had all been running from between 5 hours (20141s) and 7.3 hours (25943s).

    You may want to check the WordPress web site and forums for possible causes and solutions. If you have any further questions or if you need anything else please let me know. Thank you for using HostRocket!

    Thread Starter andrejzlender

    (@andrejzlender)

    Hi,

    i checked and have no sleeping/hung database connections.

    THX, Andrej

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error connecting to database’ is closed to new replies.