推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
barbery
10.1D
1.4D
V2EX  ›  Python

SAE下 使用MySQLdb 常常报错 OperationalError: (2006, 'MySQL server has gone away'),MySQLdb 下木有max_idle_time 肿么办?

  •  
  •   barbery ·
    barbery · Jan 6, 2013 · 5207 views
    This topic created in 5014 days ago, the information mentioned may be changed or developed.
    5 replies  •  1970-01-01 08:00:00 +08:00
    VYSE
        2
    VYSE  
       Jan 7, 2013   ❤️ 1
    拿到cursor前conn.ping一下,断了的话就自动重连了

    http://www.neotitans.com/resources/python/mysql-python-connection-error-2006.html
    ElmerZhang
        3
    ElmerZhang  
       Jan 7, 2013
    set wait_timeout=xxxx
    设置闲置连接超时时间
    barbery
        4
    barbery  
    OP
       Jan 7, 2013
    @mercurylanded 谢谢回答,你这个文章我看过,不过就像我标题所说 MySQLdb 下木有max_idle_time 。
    @VYSE 灰常谢谢!!!貌似是正解!!!
    @ElmerZhang set wait_timeout=xxxx 我看了手册:http://mysql-python.sourceforge.net/MySQLdb.html 找不到这个属性啊亲
    ElmerZhang
        5
    ElmerZhang  
       Jan 7, 2013
    @barbery 这是一条 SQL 语句
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   994 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 22:40 · PVG 06:40 · LAX 15:40 · JFK 18:40
    ♥ Do have faith in what you're doing.