python mysql重新连接_如何启用MySQL客户端自动与MySQLdb重新连接?

如果您使用的是ubuntu Linux,那么python mysql包中添加了一个补丁,可以设置相同的mysql选项(请参见here)。不过,我还没有试过。

不幸的是,后来由于与autoconnect和transactions(描述为here)冲突而删除了修补程序。

那一页的评论说:

1.2.2-7《无畏号》2008-06-19出版

python mysqldb(1.2.2-7)不稳定;紧急度=低

[桑德罗·托西]

*借方/控制

-“说明”中的“列出项目”行以两个空格开头,以避免重新格式化

在网页上(关闭:#480341)

[贝恩德泽米茨]

*debian/patches/02_reconnect.dpatch:

-正在删除修补程序:

风暴中的评论解释了问题:# Here is another sad story about bad transactional behavior. MySQL

# offers a feature to automatically reconnect dropped connections.

# What sounds like a dream, is actually a nightmare for anyone who

# is dealing with transactions. When a reconnection happens, the

# currently running transaction is transparently rolled back, and

# everything that was being done is lost, without notice. Not only

# that, but the connection may be put back in AUTOCOMMIT mode, even

# when that's not the default MySQLdb behavior. The MySQL developers

# quickly understood that this is a terrible idea, and removed the

# behavior in MySQL 5.0.3. Unfortunately, Debian and Ubuntu still

# have a patch right now which *reenables* that behavior by default

# even past version 5.0.3.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值