Recent versions of MySQL (5.0.3+) changed the default
reconnect flag from 1 (auto-reconnect) to 0 (don't
reconnect automatically). From
"Note that upon connection, mysql_real_connect() sets
the reconnect flag (part of the MYSQL structure) to a
value of 1 in versions of the API older than 5.0.3, or
0 in newer versions. A value of 1 for this flag
indicates that if a statement cannot be performed
because of a lost connection, to try reconnecting to
the server before giving up. As of MySQL 5.0.13, you
can use the MYSQL_OPT_RECONNECT option to
mysql_options() to control reconnection behavior."
I'd like to see this option supported by MySQLdb soon
so that I can get rid of those annoying "MySQL server
has gone away" errors.
Log in to post a comment.