查看_mysql文档,我发现:
help(_mysql.connection)
class connection(__builtin__.object)
...
load_infile
int, non-zero enables LOAD LOCAL INFILE, zero disables
然后,我尝试创建一个连接,我有:
python> _mysql.connection(host = ..., db = ..., user = ..., passwd = ..., load_infile = 1)
TypeError Traceback (most recent call last)
<ipython-input-23-e3878d45fb4e> in <module>()
----> 1 _mysql.connection(host = ..., db = ..., user = ..., passwd = ..., load_infile = 1)
TypeError: 'load_infile' is an invalid keyword argument for this function
我缺少什么?
供参考:
In [25]: _mysql.version_info
Out[25]: (1, 2, 3, 'final', 0)
In [26]: _mysql.get_client_info()
Out[26]: '6.0.0'
答案 0 :(得分:1)
我认为你是因为错误而尝试这个:
_mysql_exceptions.OperationalError:(1148,'此MySQL版本不允许使用的命令')
我几个小时都在努力,但终于找到了解决方案:
MySQLdb.connect(server, username, password, database, cursorclass = MySQLdb.cursors.DictCursor, local_infile = 1)
我知道您的问题是关于_mysql而不是MySQLdb,但根据mata的评论,您不应该使用_mysql