2006, 'MySQL server has gone away'

描述:mysql服务端断开idle过期连接,而客户没有检测重连所以报错。

解决:

def is_connection_usable():
    try:
        connection.connection.ping()
    except:
        return False
    else:
        return True


def do_queue():
    while True:
        if not is_connection_usable():
            connection.close()
        # do long time task

  

相关文章:

  • 2022-01-22
  • 2021-12-22
  • 2022-01-25
  • 2022-12-23
  • 2022-01-20
  • 2022-03-01
  • 2021-08-04
猜你喜欢
  • 2022-01-12
  • 2021-05-27
  • 2022-01-18
相关资源
相似解决方案