Jump to content

Archived

This topic is now archived and is closed to further replies.

mailtome

Too many connections

Recommended Posts

Hi
I am getting the following error
PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Too many connections in /usr/share/pear/adodb/drivers/adodb-mysql.inc.php on line 340

Can anyone tell me the possible reasons for this

Share this post


Link to post
Share on other sites
you have reached the maximum number of concurrent connections to your mysql database.

Are you using mysql_pconnect() or mysql_connect() ?

I was using pconnect for a long time, and couldnt figure out the reason why it kept maxing out. Turned out every database conection stayed open and kept adding new connections on top.

Share this post


Link to post
Share on other sites
[!--quoteo(post=368310:date=Apr 25 2006, 02:39 AM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Apr 25 2006, 02:39 AM) [snapback]368310[/snapback][/div][div class=\'quotemain\'][!--quotec--]
you have reached the maximum number of concurrent connections to your mysql database.

Are you using mysql_pconnect() or mysql_connect() ?

I was using pconnect for a long time, and couldnt figure out the reason why it kept maxing out. Turned out every database conection stayed open and kept adding new connections on top.
[/quote]
I am using mysql_connect

Share this post


Link to post
Share on other sites
Do you have a lot of users using the mysql database / your site at the same time?

Share this post


Link to post
Share on other sites
I cant remember where it is now, but there is a mysql ini file with a setting for max concurrent connections, simply increase that to the maximum connections you might require.

However, if you're not having many users online at once at the moment (less than 20 for example) and you're not using mysql_pconnect i see no reason why this should be max'ing your connections.

Share this post


Link to post
Share on other sites
Perhaps a simpler option would be to use mysql_close at the end of your scripts and to restart your server - that will kill any connections currently persisting.

Share this post


Link to post
Share on other sites
I close the connections when ever I open them. But I think that should not matter because I am using mysql_connect. This is from PHP documentation
[b]Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.[/b]

Share this post


Link to post
Share on other sites
I can only suggest finding out what the current max connections is set to, and how many connections you have running.

In phpmyadmin you can find out what connections there are by doing the following;

From the main page choose "show processes"
This will display all active connections.

At present mine shows two connections, and we have 7 users currently online, each with an automatic query running every 60 seconds.

Share this post


Link to post
Share on other sites
exactly. Still dont understand how you've got max connections on if you're not letting anyone use the script except yourself and you're not using pconnect though.

Is this a local install or is it on an ISP installation? Have you used this before for other projects?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.