我有一個使用MySQL數據庫的python程序。
我收到以下錯誤。
如果有人幫我解決問題,我將非常感激。嘗試執行使用MySQL的Python程序時發生錯誤
Traceback (most recent call last): File "version2_1.py", line 105, in refine(wr,w)#function for replacement File "version2_1.py", line 49, in refine wrds=db_connect.database(word) File "/home/anusha/db_connect.py", line 6, in database db = MySQLdb.connect("localhost","root","localhost","anusha") File "/usr/lib/pymodules/python2.6/MySQLdb/_init_.py", line 81, in Connect return Connection(*args, **kwargs) File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 170, in __init__ super(Connection, self).__init__(*args, **kwargs2) _mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")
爲什麼你指定'localhost'兩次? – bernie 2011-04-09 17:48:29
哎呀對不起,但我糾正了這個錯誤,現在我得到了與此行相同的錯誤db = MySQLdb.connect(「localhost」,「root」,「anusha」,「anusha」) – Anusha 2011-04-14 07:38:53