我已經安裝了python 2.7 32bit,然後我通過MySQL-python-1.2.3.win32-py2.7安裝了MySQLdb 它成功了。但是當我嘗試一下時,它有一些問題。我對MySQLdb有一些疑問
我寫在空閒時:
import MySQLdb
conn = MySQLdb.connect (passwd = "chen1991", db = "myddb")
cursor = conn.cursor()
cursor.execute ("SELECT VERSION()")
它說我不能連接databass,結果如下:
conn = MySQLdb.connect (passwd = "chen1991", db = "myddb")
File "D:\python安裝位置\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "D:\python安裝位置\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'ODBC'@'localhost' (using password: YES)"
密碼:是指我採取正確的密碼,所以我不知道發生了什麼事。當我安裝時,我有什麼錯誤嗎?
您確定要以用戶「ODBC」的身份連接到數據庫嗎? – qsheets 2012-02-25 04:09:15