ctcutler - 2009-12-14

Hello All,

I'm using mysql-python 1.2.1p2 with python 2.3.4 on CentOS 4.8 connecting to
MySQL 5.0.72 on another server running CentOS 5.2. I have discovered that if I
have an open connection to the database and the database restarts, I get the
expected 'Lost connection to MySQL server ..." error but then on every
subsequent query I get an InterfaceError exception.

Here's what it looks like:

conn = MySQLdb.connect(

)

cursor = conn.cursor()

cursor.execute("USE pipesecure_com_st")

0L

cursor.execute("USE pipesecure_com_st")

Traceback (most recent call last):

File "<stdin>", line 1, in ?

File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 163, in
execute

self.errorhandler(self, exc, value)

File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line 35, in
defaulterrorhandler

raise errorclass, errorvalue

_mysql_exceptions.OperationalError: (2013, 'Lost connection to MySQL server
during query')

cursor.execute("USE pipesecure_com_st")

Traceback (most recent call last):

File "<stdin>", line 1, in ?

File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 163, in
execute

self.errorhandler(self, exc, value)

File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line 35, in
defaulterrorhandler

raise errorclass, errorvalue

_mysql_exceptions.InterfaceError: (0, '')

cursor.execute("USE pipesecure_com_st")

Traceback (most recent call last):

File "<stdin>", line 1, in ?

File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 163, in
execute

self.errorhandler(self, exc, value)

File "/usr/lib/python2.3/site-packages/MySQLdb/connections.py", line 35, in
defaulterrorhandler

raise errorclass, errorvalue

_mysql_exceptions.InterfaceError: (0, '')

When I run this same code with mysql-python 1.0.0 it works much better: I see
the "Lost connection to MySQL server. . . " exception and then subsequent
queries work fine.

I'm looking into upgrading to a newer MySQL python (downgrading is not an
option) but I may not be able to do so. Does anyone know what's going on here
and if there is any way to fix it?

Thanks,

ctcutler