Re: Connecting To Multiple MySQL Databases
| From: | Richard Lynch | Date: | Tue, 08 Feb 2005 20:07:42 +0000 |
| Subject: | Re: Connecting To Multiple MySQL Databases | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-208288@lists.php.net to get a copy of this message | ||
Silvio Porcellana wrote:
> Richard Lynch wrote:
> >
>> <snip />
> >
>> Actually, you want a few SPARE MySQL connections, so you can use the
>> mysql
>> command line monitor to do things -- Particularly in case of a run-away
>> PHP/MySQL script which slams the server into over-drive... If you don't
>> have a connection available cuz they're all used up by Apache/_pconnect,
>> you can't log into mysql monitor and you can't use mysqladmin to bring
>> it
>> down nicely and... Don't do that. :-)
> >
>> <snip />
>>
> Actually, MySQL already takes care of that as it allows 'max_connections +
> 1' clients to
> connect, leaving the '+1' connection for the user(s) with SUPER privilege
> (that can
> therefore issue a "SHOW PROCESSLIST" or nicely bring down the server).
>
> http://dev.mysql.com/doc/mysql/en/too-many-connections.html
True.
However, there's often somebody with a mysql monitor left open/hanging
tying up a resource, and ...
Actually, to be sure it's clear:
Apache will hold a connection for EACH username/password used to _pconnect.
So if you've got, say, two different username/passwords using _pconnect to
the database, you need twice as many max_connections in /etc/my.cnf as you
have Apache children, plus your spares.
The re-usable _pconnect data structures are tied to username/password to
be sure they don't "leak" data from one username to the other for security
reasons, I think. And I reckon a lot of the username-based access is
built into the connection structure, so it wouldn't be efficient to scrap
all that and re-build -- It wouldn't be _pconnect any more.
--
Like Music?
http://l-i-e.com/artists.htm