0
>>> db=MySQLdb.connect(passwd="king123",db="thangs",host="localhost",port=3306,user="user")

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    db=MySQLdb.connect(passwd="king123",db="thangs",host="localhost",port=3061,user="user")
  File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")

我在正确的端口上运行它,它仍然给我错误。任何人都可以给我任何想法吗

4

1 回答 1

0

如果你看不到这个端口,这意味着 mysql 没有运行,在这种情况下错误是有意义的。请参阅如何打开 mysql 服务器。

于 2012-11-16T16:39:23.553 回答