MySQL: Enable LOAD DATA LOCAL INFILE reset

若如初见. 提交于 2020-05-31 04:18:27

问题


After reading several answers on here, I finally figured out why my .csv file wasn't loading in through the command prompt. I had to enable load data local infile. Once I did that, I read the global variables and they were on. I was able to load the data then. However, after closing the command prompt, I reopened it and while the variable was still reading as ON, it wouldn't allow me to import another .csv file. Do i need to turn local infile off and back on for it to work again

EDIT: this is the code that I am attempting to use to upload. It worked the first time (not even 30 minutes ago), but now it won't work

load data local infile '…\\Mod 8\\Vehicles_2016.csv'
into table vehicles_2016
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
ignore 1 lines
(@col1, @dummy, @dummy, @col2
,@dummy, @dummy, @dummy, @dummy, @dummy
,@dummy, @dummy, @dummy, @dummy, @dummy
,@dummy, @dummy, @dummy, @dummy, @dummy
,@dummy, @dummy, @dummy, @dummy, @dummy
)
set accident_index=@col1,vehicle_type=@col2;

Additionally, I tried turning off the global variable and turning it back on before loading, but that didn't work.


回答1:


Each mysql client connection needs to be started with '--local-infile' or the corresponding option in the database API.



来源:https://stackoverflow.com/questions/54623557/mysql-enable-load-data-local-infile-reset

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