我有一个在本地主机上运行的本地 mysql 服务器,Windows 7
C:\web>mysqld --console
[...]
130428 19:12:37 [Note] mysqld: ready for connections.
Version: '5.5.31-log' socket: '' port: 3306 MySQL Community Server (GPL)
如果我尝试连接 mysql,我没有问题(root 没有密码)
C:\Users\Alle>mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.31-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use information_schema
Database changed
mysql>
但是当我尝试通过MySQL-Python 1.2.4连接到 mysql 时失败:
C:\Users\Alle>python
Python 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.connect('localhost', 'root', '', 'information_schema')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")
这是我的会议
我坚持这一点,我不知道该怎么做..我可以做些什么来调试问题并让mysql-python工作?我需要这个用于 Django,所以我不能切换连接器。