[DB-SIG] MySQL error 2013,
'Lost connection to MySQL server during query'
pythontutor at venix.com
Tue May 20 17:09:40 EDT 2003
OperationalError: (2013, 'Lost connection to MySQL server during query'
I am getting occasional Lost Connection errors even when running against
localhost. I do not have a reliable way to generate these errors, but they
occur too often to ignore. I am starting to wonder if I could have made a
mistake in how I use the API. I am using the MySQLdb module to connect to
a MySQL database.
The code uses the connection object:
to get a cursor
execute an SQL command
save/print/use the result
I have not been closing cursors, but simply leaving them to get garbage
collected. I have not been reusing cursors for successive queries.
Should I be closing cursors? Would I be better off reusing the same
cursor where possible?
Any advice would be greatly appreciated.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
More information about the DB-SIG