使用Python时,此MySQL版本不允许使用used命令
我在mac上运行此程序时收到以下错误消息。它在原始Linux计算机上运行良好:使用Python时,此MySQL版本不允许使用used命令,python,mysql,macos,mysql-python,Python,Mysql,Macos,Mysql Python,我在mac上运行此程序时收到以下错误消息。它在原始Linux计算机上运行良好: File "setupPpiDb.py", line 406, in modules createDataBase(pdbsToAnalyzeWithChains) File "setupPpiDb.py", line 202, in createDataBase ''' %(os.path.join(RESULTS_DIR, 'PerAtomDistance.csv'))) File "/Library/F
File "setupPpiDb.py", line 406, in modules
createDataBase(pdbsToAnalyzeWithChains)
File "setupPpiDb.py", line 202, in createDataBase
''' %(os.path.join(RESULTS_DIR, 'PerAtomDistance.csv')))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/MySQLdb/cursors.py", line 250, in execute
self.errorhandler(self, exc, value)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/MySQLdb/cursors.py", line 247, in execute
res = self._query(query)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/MySQLdb/cursors.py", line 412, in _query
rowcount = self._do_query(q)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/MySQLdb/cursors.py", line 375, in _do_query
db.query(q)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/MySQLdb/connections.py", line 276, in query
_mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1148, 'The used command is not allowed with this MySQL version')
我正在mac上运行Python3,并下载了最新的社区下载版本MySQL数据库。完整命令如下所示:
cursor.execute('''
load data local infile '%s' into table interfaceDist fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' ignore 1 lines (PDB,Chains,Chain,ResId,Symbol,Atom,MinDist);
''' %(os.path.join(RESULTS_DIR, 'PerAtomDistance.csv')))
我读到有人发布了本地infle命令。但是,命令的第二行有问题,我使用local_infle=1通过以下方式连接到数据库:
connect(host='localhost',user=user,passwd=passwd,db=db\u NAME,local\u infle=1)
关于如何修复这个bug有什么想法吗 MySQL的具体版本是什么?MySQL 8.0.11版,适用于x86_64(自制)上的osx10.13。这可能与查询的
LOCAL
部分有关,因此我会尝试通过另一个MySQL连接(例如MySQL
shell或MySQL Workbench)来确认是否有此连接。MySQL 8+已经破坏了一些旧的MySQL驱动程序,因此您也可以尝试最新的5.7版本。