【发布时间】:2014-11-06 22:58:52
【问题描述】:
# -*- coding: utf-8 -*-
import MySQLdb
import sitedb
for i in range(5):
print i
cred = sitedb.loadmysqlcredential()
db = MySQLdb.connect(host = cred["host"], user = cred["user"], passwd = cred["passwd"], db = "vg_site_db", charset = 'utf8')
db.close()
我在不同的服务器上有 MySQL:Windows 和 Linux。在 Win 此代码工作正常。在 Linux on 第三次迭代 mysql sad: Lost connection to MySQL server at 'reading initial communication packet', system error: 0.
我必须在 Linux 服务器上进行哪些更改?
UPD:
问题是我有循环(for),当 i = 0 连接发生时,也像 i = 1 和 2,但接下来连接被阻塞
【问题讨论】: