How to track error / EXPERT ADVICE REQUIRED

Discussion in 'MySQL' started by deriklogov, Jul 27, 2008.

  1. #1
    From time to time I am getting error:

    Warning: mysql_connect() [function.mysql-connect]: Too many connections in /home/hotmouse/public_html/includes/functions/database.php on line 19
    Unable to connect to database server!


    Which shutdown mysql until I would have manually restart it, how track which script could cause that and track it down ?
     
    deriklogov, Jul 27, 2008 IP
  2. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #2
    If it is linux server you may install mytop on your server. additional you can increase the number of connection from MySQL configuration file (usually it is my.cnf). Please note it if you increase the number of connection, it may increase your server load depending on the connections.

    Kailash
     
    kailash, Jul 27, 2008 IP
  3. klimu

    klimu Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ok, try mysql command SHOW PROCESSLIST; to see if there are some idle processes and debug your code. (mytop actually does show the same information). Some coders have a bad habit of not closing their connections and on some setups the connections will stay idle and reserve connection until they time out.
     
    klimu, Jul 28, 2008 IP
  4. deriklogov

    deriklogov Well-Known Member

    Messages:
    1,079
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    130
    #4
    Like after server gets stuck with that overload all processes becomes idle , so there is no way to understand which one cause that. Can you suggest something else ?
     
    deriklogov, Jul 28, 2008 IP
  5. Bohol

    Bohol Peon

    Messages:
    2,680
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I also experienced the same problem in one of my forum sites. See the home site here... It has more than 168,000 forum posts.

    How can I solve the connection error database problem?
     
    Bohol, Jul 28, 2008 IP
  6. klimu

    klimu Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Check out your error log..
     
    klimu, Jul 29, 2008 IP