我试图连接到远程MySQL数据库,我遇到了这个错误
"Lost connection to MySQL server during query (%s)" % (e,))
peewee.OperationalError: (2013, 'Lost connection to MySQL server during query ([Errno 10054] An existing connection was forcibly closed by the remote host)')
这是代码
from peewee import *
print "connecting"
db = MySQLDatabase("mydb", user="myuser", passwd="crypticpassword!", port=someport, host="someremotehost.com")
db.connect()
print "connected"
所以我想,确定,让我们尝试连接而不使用代码。我尝试使用Heidi,通过Microsoft SQL Server连接,没有任何问题。我应该考虑哪些想法来解决这个问题?
答案 0 :(得分:-1)
确保已下载mysql How to install Python MySQLdb module using pip? 还导入mysql
import MySQLdb