1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

1040 Error : Too many connections - HELP?

Discussion in 'MySQL' started by Whatarewewaitingfor?, Jan 7, 2009.

  1. #1
    Whatarewewaitingfor?, Jan 7, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Means there are too many simultaneous connections to your database. You can fix this by increasing the number of allowed connections to your database. This value is set in your my.ini file. You can also use a singleton database connector to reduce the number of individual connections made to the database.
     
    jestep, Jan 7, 2009 IP
  3. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #3
    The variable to configure is max_connections.
     
    mwasif, Jan 7, 2009 IP
  4. Whatarewewaitingfor?

    Whatarewewaitingfor? Active Member

    Messages:
    253
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #4
    I appreciate the help, but where do I change the variable? The site is running Cubecart, and I cannot locate a .ini file on the server.
     
    Whatarewewaitingfor?, Jan 7, 2009 IP
  5. Whatarewewaitingfor?

    Whatarewewaitingfor? Active Member

    Messages:
    253
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #5
    I can see that the max_connections is set to 100 at the moment. Where can increase this?

    Also : does this mean there are too many visitors coming to my site at the same time? I just set up Paypal IPN on this last night. Could that have something to do with this error?
     
    Whatarewewaitingfor?, Jan 7, 2009 IP
  6. Whatarewewaitingfor?

    Whatarewewaitingfor? Active Member

    Messages:
    253
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #6
    It just started working of its own accord. Thanks for the help anyway guys!
     
    Whatarewewaitingfor?, Jan 7, 2009 IP
  7. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #7
    Make sure you don't use persistent connection to the database. Otherwise each request (handled by each Apache child process) would create a new database connection that stays connected for a long time, so you'll always run out of the number of connections limit.

    If this was really what happened to you, it's possible that the persistent connections had timed out (therefore closed) so it's now working again. But soon you'd get the same problem again.
     
    phper, Jan 7, 2009 IP
  8. Whatarewewaitingfor?

    Whatarewewaitingfor? Active Member

    Messages:
    253
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #8
    Good point Phper, that would be a good explanation of why that happened and fixed itself. So...how do I change this from persistent to not persistent?
    I appreicate the help!
     
    Whatarewewaitingfor?, Jan 8, 2009 IP
  9. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #9
    mwasif, Jan 12, 2009 IP
  10. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #10
    hi there,

    I am having the same issues, i changed mysql_pconnnect to mysql_connect, but is still get the Fatal error: Too many connections. Is there a way to delete all connections?

    btw i use mysql_free_result($rs);
     
    123GoToAndPlay, Feb 10, 2009 IP
  11. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #11
    You may need to ptimize your queries as well that they are taking too much time. Read @ MySQL manual about this.
     
    mwasif, Feb 10, 2009 IP