Page 1 of 1

mysql error

Posted: Fri Jan 12, 2007 8:53 am
by itsmani1
hay when i try to connect with mysql_connect gets following error.
any solution. It was working fine yesterday but now giving error.

Error:
Too many connections

Posted: Fri Jan 12, 2007 9:28 am
by impulse()

Posted: Sat Jan 13, 2007 1:19 am
by itsmani1
Can you please tell me what does this mean:
I think it mean available mysql connecitons = 1000
I am not sure if i am right or not?

Max Requests Per Child: 4000 - Keep Alive: off - Max Per Connection: 1000


thank you

Posted: Sat Jan 13, 2007 9:37 pm
by Ambush Commander
No, that's with regards to max connections to PHP and does not affect MySQL in any way.

Posted: Sun Jan 14, 2007 11:31 pm
by itsmani1
RAM is of 1 GB so i think it should not affect it.
what's the proper way to close the mysql connection?

Posted: Sun Jan 14, 2007 11:53 pm
by feyd

Posted: Mon Jan 15, 2007 12:04 am
by itsmani1
feyd wrote:mysql_close()
I am doing something like this:

connection.php

Code: Select all

$link = mysql_connect("localhost","root","pass") or die(mysql_error());
	mysql_select_db("ticket_chest",$link);
test.php

Code: Select all

include "connection.php";
        $qr = "my query";
	$res = mysql_query($qr) or die(mysql_error());
	while($row = mysql_fetch_array($res))
	{
                  // Fetching values
	}

	mysql_close($link);
here is get

too many connections
and when i restart the server it starts working fine.
and then after 20 hours i get this error again.

Posted: Mon Jan 15, 2007 12:16 am
by feyd
I can only guess that something or someone else is using up the connections pool. It may be a good idea to turn on logging.

Take a look here: http://dev.mysql.com/doc/refman/5.0/en/log-files.html

Posted: Mon Jan 15, 2007 12:23 am
by itsmani1
feyd wrote:I can only guess that something or someone else is using up the connections pool. It may be a good idea to turn on logging.

Take a look here: http://dev.mysql.com/doc/refman/5.0/en/log-files.html
can i solve it by making a new mysql user on database? will it work?
as you mentioned that may be someone esle is using this connection pool

I am using mysql 4.1.x

Posted: Mon Jan 15, 2007 12:28 am
by feyd
itsmani1 wrote:can i solve it by making a new mysql user on database? will it work?
Hmm.. I don't think so, but since I've not run into this issue myself, I can't say with authority.
itsmani1 wrote:I am using mysql 4.1.x
http://dev.mysql.com/doc/refman/4.1/en/log-files.html :)

Posted: Mon Jan 15, 2007 1:02 am
by itsmani1
feyd wrote:
itsmani1 wrote:can i solve it by making a new mysql user on database? will it work?
Hmm.. I don't think so, but since I've not run into this issue myself, I can't say with authority.
itsmani1 wrote:I am using mysql 4.1.x
http://dev.mysql.com/doc/refman/4.1/en/log-files.html :)

thank you,
some one suggested me to go for: mysql_pconnect()
will it make difference?

Posted: Mon Jan 15, 2007 1:12 am
by Christopher
itsmani1 wrote:some one suggested me to go for: mysql_pconnect()
will it make difference?
It may, but will probably make it worse. You only need to type one character to try it so let us know. However, without knowing what the problems you will never really have a solution.

Posted: Mon Jan 15, 2007 1:21 am
by itsmani1
arborint wrote:
itsmani1 wrote:some one suggested me to go for: mysql_pconnect()
will it make difference?
It may, but will probably make it worse. You only need to type one character to try it so let us know. However, without knowing what the problems you will never really have a solution.
yes it has made it worse.
this is the error:
#1040 - Too many connections


One more thing: how can i find total available connections?
and
how can i find consumed connections and free connections?

I tried :

Code: Select all

mysql_stat($link)
and got

Uptime: 12075
Threads: 54
Questions: 638
Slow queries: 0
Opens: 20
Flush tables: 1
Open tables: 14
Queries per second avg: 0.053

thank you