Problem with SQL ERROR

Discussion in 'Databases' started by Janesh, Sep 14, 2009.

  1. #1
    Greeting everyone,
    well recently I have set up a forum on the free host of 000webhost.com but unfortunately many user on my forum have complain of obtaining this error(see image below)

    [​IMG]


    Can anyone give me some idea of what is it about and how to resolve it.
     
    Janesh, Sep 14, 2009 IP
  2. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #2
    The error you see has nothing to do with your site.

    The web server that you are hosted on has reached the max connections allowed on the MySQL config. Your host should be notified about this. He can increase the number of connections himself, however doing this may increase the load on his server.
     
    Talker, Sep 15, 2009 IP
  3. HappyDaze

    HappyDaze Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, I agree, that is the reason for the error.
     
    HappyDaze, Sep 16, 2009 IP
  4. ThomasTwen

    ThomasTwen Peon

    Messages:
    113
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, indeed. Every time any user looks up your website, he or she causes a new connection to the database server to be opened. Many servers only have a limited amount of connections allowed.

    What you can do:
    1) Get a better hoster. Might be expensive.
    2) Optimize the forum software so that it runs faster.
    Many people I know use "SELECT * FROM ..." SQL Querys instead of "SELECT field_name, field_name, field_name FROM ..." when you don't need all of the fields. The second one is a lot faster, as it does not request all the fields from the server. Only get what you need.
    3) As you are probably using php, you might want to use mysql_pconnect() instead of mysql_connect() to establish the database connection to your database server. It establishes one permanent connection to the database, which is used for all the queries from all the users. Please note that your hoster may not like this and that this might change the behaviour of some of your scripts. As always, php.net can help you with this command.
    www.php.net/function.mysql-pconnect

    It kind of sucks that this forum does not allow me to post links because I'm new here...
     
    ThomasTwen, Sep 26, 2009 IP