Tôi nhận được những điều sau đây hàng ngày. Các tập lệnh của tôi đang chạy qua các công việc cron. Bất cứ ai có thể giúp đỡ để sửa lỗi này?Máy chủ MySQL đã biến mất - Python
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away')
Mã của tôi:
def get_id(test_mysql_conn,id):
cursor = test_mysql_conn.cursor()
cursor.execute("""select id from test where id = %s """, (id))
row = cursor.fetchone()
if row is not None:
return row[0]
return 0
Hãy xem câu trả lời này: http://stackoverflow.com/a/982873/974317 –
kiểm tra [this] (http://dev.mysql.com/doc/refman/5.0/en/gone-away.html). –
Để biết thông tin của bạn, lỗi này có thể xảy ra khi bạn vượt quá kích thước gói tối đa: xem [tại đây] (http://serverfault.com/a/528183/341327) – PlasmaBinturong