OperationalError: (2006, 'MySQL server has gone away')

刘超 12天前 ⋅ 94 阅读   编辑

一、描述

  python MySQLdb连接mysql报如下错误

Exception in thread Thread-28:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./dsp_report/Meitu.py", line 52, in Meitu
    insertTiDB(resultDF)
  File "pull_dsp_report.py", line 268, in insertTiDB
    insert_num=official_conn.execute_many(insert_sql,fullDataframe.values.tolist())
  File "/home/sdev/liujichao/py_lib/db.py", line 84, in execute_many
    self.db_conn.commit()
OperationalError: (2006, 'MySQL server has gone away')

二、解决方法

  使用ping,带ping示例


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: