开发者

python MySQLdb error?

开发者 https://www.devze.com 2023-02-06 03:36 出处:网络
while i am trying to connect with python MySQLdb, i get an \'Invalid Arguments\' error. import MySQLdb

while i am trying to connect with python MySQLdb, i get an 'Invalid Arguments' error.

import MySQLdb
conn = MySQLdb.connect (host = "localhost",user = "root",passwd = "",db = "test")

what is the reason for getting such a error?.

But, the following code with _mysql works fi开发者_开发技巧ne.

db=_mysql.connect("localhost","root","","test")


import MySQLdb.cursors

DATABASE= MySQLdb.connect(host='localhost', user='username', passwd='password', db='databasename', cursorclass=MySQLdb.cursors.DictCursor)

Hope it helps.


Shouldn't that be

conn = MySQLdb.connect ("localhost","root","","test")

?

(random reference: http://www.tutorialspoint.com/python/python_database_access.htm )

0

精彩评论

暂无评论...
验证码 换一张
取 消