too many connections

Discussion in 'MySQL' started by kingerrormessage, Nov 22, 2007.

  1. #1
    i have a problem with my mysql database, i have some errors in my code which means that too many connections have been made to the database and i can't make any more. i'm in the process of checking through the code to fix this, but i need to know how to get rid of the connections which have already been made. also, is there any way using phpmyadmin to see how many connections have been made to my database so i can keep an eye on this in the future and try to prevent it getting to this stage again?

    thank you
    karl
     
    kingerrormessage, Nov 22, 2007 IP
  2. Johncena

    Johncena Banned

    Messages:
    312
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    do u have ssh access
     
    Johncena, Nov 22, 2007 IP
  3. kingerrormessage

    kingerrormessage Guest

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes i do, but i don't know what it is, so if you have a suggestion involving ssh, could you lay it out in really simple terms, thanks
     
    kingerrormessage, Nov 22, 2007 IP
  4. Chill

    Chill Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This is what happens with DDOS attacks so you probably have some endless loop in your code hitting the database with queries. If so then knowing the query count or trying to stop them is hopeless because the cpu will go so slow and have lots more to processs.

    Restarting mysql is what I would do. If you are actually using that much resource and want to try and dig around the queries then your code must be pretty serious. :D The database wont fall over with a few crap queries
     
    Chill, Nov 22, 2007 IP
  5. Chill

    Chill Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If your new to ssh then its not an ideal way to help with your issue. phpmyadmin will not be able to connect either. Check your cpu usage, if you cant restart mysql on its own then can you restart apache/webserver? Check your web servers error log, if it's php then thats where your likely to find the error
     
    Chill, Nov 22, 2007 IP
  6. Kynlem

    Kynlem Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If high number of conections doesn't increase constantly, you may still be able to connect using phpMyAdmin if you catch the right moment. Then you can get the list of all client connections w/ list of operations they're doing using SHOW PROCESSLIST.
     
    Kynlem, Nov 22, 2007 IP
  7. Kuldeep1952

    Kuldeep1952 Active Member

    Messages:
    290
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    60
    #7
    This error also occurs if your hosting provider has set a limit on the
    number of connections per hour per user, and you exceed that.
     
    Kuldeep1952, Nov 23, 2007 IP
  8. stillo

    stillo Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Is it dedicateserver or VPS?
    You need to optimize your database. Or just upgrade your server.
     
    stillo, Nov 23, 2007 IP
  9. kingerrormessage

    kingerrormessage Guest

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    sorry for not replying sooner, i've been busy today.

    if this is a DDoS thing, will it be caused by my site (which is very small, consisting of fewer than a dozen pages, or will it be something else? if it is something else, is there anything i can do in the future to try and reduce the likelyhood of this happening.

    as for the server which the database is on, it's not my server, it's one i have access to through my hosting company.

    thank you
    karl
     
    kingerrormessage, Nov 23, 2007 IP
  10. zonzon

    zonzon Peon

    Messages:
    100
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #10
    humm... looks like a php persistent connection problem...

    Persistent connections are SQL links that do not close when the execution of your script ends. When a persistent connection is requested, PHP checks if there's already an identical persistent connection (that remained open from earlier).

    Persistent connections are efficient if the overhead to create a link to your SQL server is high, for example because the web server does not run on the same computer as the database server.

    Persistent connections do not give you any functionality that is not possible with non-persistent connections.
    They were designed to have one-to-one mapping to regular connections. You should always be able to replace persistent connections with non-persistent connections.

    Look at your php.ini folowing configuration: mysql.allow_persistent = On

    hope that helps
     
    zonzon, Nov 24, 2007 IP