Re: Too Many Connections
| From: | Monty | Date: | Fri, 18 Apr 2003 20:15:28 +0000 |
| Subject: | Re: Too Many Connections | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144432@lists.php.net to get a copy of this message | ||
> On 18-Apr-2003 Monty wrote:
>> I am getting a "Too Many Connections" error now with MySQL. I've done
>> some
>> searching here to find solutions, but, was wondering if anyone knew of
>> any
>> sites that have detailed info about how to resolve this problem in MySQL
>> and
>> PHP. I'm not sure where to begin as far as optimizing my code to reduce
>> database access. One thing I did do is I start using mysql_connect
>> (instead
>> of pconnect) for some quick-and-dirty routines to reduce this problem.
>> While
>> it has helped some, it hasn't made the problem go away.
>>
> mysql> show variables like '%timeout';
> mysql> show variables like 'max_conn%';
>
> increase max_connections
> decrease wait_timeout, interactive_timeout.
>
> Regards,
> --
> Don Read dread@texas.net
> -- It's always darkest before the dawn. So if you are going to
> steal the neighbor's newspaper, that's the time to do it.
Thanks Don. I looked at the MySQL site for more info on this and am still
confused. I know I need to put this in a my.cnf file in the /etc directory
on my server, but, I'm not exactly sure of the format for this file. Is this
what I need to do in my.cnf?
---------
[client]
set-variable = max_connections = 150
set-variable = wait_timeout = 14400
set-variable = interactive_timeout = 14400
---------
Is this what I need to do to increase connections and decrease wait_timeout
and interactive_timeout from 28800 to 14400? Is 14400 a good idea or is that
too little/much? I have no clue after spending an hour on the MySQL site
looking through their horrible documentation.
I know this isn't PHP, but, I've tried joining the MySQL mailing list with
no success, and MySQL for some reason still doesn't have a well-run
newsgroup like PHP.
Monty