In my experiences, there're three reasons below.
1. Your network is not stable.
2. Your mysqld's parameter called max_allowed_packet is adjusted too small,
trying to increase it.
3. Your mysqld's parameter called connect_timeout is  adjusted too small,
trying to increase it.
On Thu, Oct 30, 2008 at 1:05 PM, mos <[EMAIL PROTECTED]> wrote:

> At 10:21 PM 10/29/2008, you wrote:
>
>> I've never had a lot of luck tracking down this sort of problem. One
>> thing I've found to be a good first step is to add each server
>> involved to the other server's /etc/hosts file (and restart MySQL so
>> it notices).
>>
>> Don't have much more to offer other than the usual suspects: recent
>> versions, persistent vs. non-persistent connections, etc. A long shot
>> would be to make sure your always talking to the same database server-
>> if you're doing, say, DNS round-robin or load balancing or something,
>> maybe you're getting shunted to a different db server and it's killing
>> the connection... don't know what your setup is. Another long shot in
>> a multi-db-server config would be to make sure they all have different
>> server ID's.
>>
>> Good luck... hopefully someone else has better advice :)
>>
>> Jake
>>
>
> Just a guess, but maybe it's your network card?
>
> I'm using MySQL 5.01 with MyISAM tables and my application will
> occasionally hang for hours in the midst of executing a simple 1 table
> Select statement. I usually end up killing the program. There are no
> processes running on the MySQL server. I think the problem was the number of
> connections the program created. Although there were only at most 10
> simultaneous connections, my program when the query finished executing, it
> threw the connection away and recreated a new one for each query, and MySQL
> reported there were some 10k connections made to the server. I ended up
> using connection pooling and now the number of connections reaches a high of
> around 10 and I haven't had the problem since.
>
> Mike
>
>  On Wed, Oct 29, 2008 at 2:47 AM, Waynn Lue <[EMAIL PROTECTED]> wrote:
>> > We've started seeing mysql errors in the logs, and when i look at the
>> output
>> > of mysql_error() (in php), i get "lost connection to mysql server during
>> > query". Here's an example stack trace:
>> >
>> > 'Can't connect to <name> database [Lost connection to MySQL server
>> during
>> > query]'
>> >
>> > Similarly, we're seeing stack traces here as well:
>> >
>> > 'Can't connect to <name> database []'
>> >
>> > I usually only see this mesasge when I don't use a connection for awhile
>> and
>> > it timeouts, but in this case, the connection is only opened for the
>> > duration of a script, which can't be running for more than a second. The
>> > mysql error logs don't show anything, and wait_timeout is set to 28800.
>> >
>> > At first, I thought it was because I was calling mysql_select_db too
>> much,
>> > so I ended up using two mysql connections per page load, but that didn't
>> > seem to change anything. How can we prevent this error from happening,
>> what
>> > else can I do to diagnose this further?  Google brings up some more
>> > discussions about it, but nothing seems related to this, like
>> packetsize.
>> > This is happening when we select two ids from a database.  And SHOW
>> > PROCESSLIST shows that the number of connections aren't even coming
>> close to
>> > max connections.
>> >
>> > Thanks for any advice,
>> > Waynn
>> >
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/[EMAIL PROTECTED]
>
>


-- 
I'm a MySQL DBA in china.
More about me just visit here:
http://yueliangdao0608.cublog.cn

Reply via email to