MySQL Workbench Load Data Local Infile error

前提是你 提交于 2019-12-22 12:51:18

问题


I have been running into a problem with MySQL's Load Data Local Infile command. I know that they disabled it by default due to a security threat. I have a SQL Script that I would like to run in MySql Workbench. I keep getting the error "1148. The used command is not allowed with this MySQL version." I have been able to get this to work from the command line using command line arguements. However I havent had any success in the Workbench. Any help would be appreciated. Here is my script.

DROP DATABASE IF EXISTS a2004TS;

CREATE DATABASE IF NOT EXISTS a2004TS;

USE a2004TS;

DROP TABLE IF EXISTS a2004TS_1;

CREATE TABLE a2004TS_1(
Version CHARACTER(25),
Dsetid CHARACTER(6),
V040001 DOUBLE,
..
.
);

SET GLOBAL local_infile = 1;

LOAD DATA LOCAL INFILE '/home/output/sqlCSV/a2004TS.sqlscripts.table1.csv'
INTO TABLE a2004TS_1
FIELDS TERMINATED BY ',' ENCLOSED BY'"'
LINES TERMINATED BY'
'(columns......);

回答1:


If the server is started with the option to disable LOAD DATA then a client has to explicitly call mysql_options(...) to enable it (http://dev.mysql.com/doc/refman/5.5/en/load-data-local.html). This does not happen in WB, so you cannot use it to load a file currently. Instead use the command line client for this.

You could file a feature request at http://bugs.mysql.com to have handling implemented that allows the import (e.g. a preference setting).



来源:https://stackoverflow.com/questions/14570668/mysql-workbench-load-data-local-infile-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!