【发布时间】:2009-07-22 09:12:14
【问题描述】:
这段代码运行良好:
import MySQLdb
db = MySQLdb.connect("localhost", "root", "","bullsorbit")
cursor = db.cursor()
cursor.execute("Select * from table where conditions'")
numrows = int(cursor.rowcount)
print 'Total number of Pages : %d ' % numrows
但如果我提供我的 IP 地址
db = MySQLdb.connect("192.168.*.*", "root", "","bullsorbit")
会报这个错误
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'ip address' (111)")
【问题讨论】:
-
您的服务器是否配置为允许 root 在非本地主机连接上登录?