Comments - LOAD DATA INFILE
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
If you are getting 1064 SQL Syntax error here, it may be because the docs above don't accurately capture what (at least on my dev environment) is a requirement on the order of the FIELDS statements.
Specifically, it seems you must have the ENCLOSED BY before the TERMINATED BY
BEFORE (throws SQL syntax error)
LOAD DATA LOCAL INFILE "C:/my_file.csv" INTO TABLE my_table CHARACTER SET UTF8 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
AFTER (works as expected)
LOAD DATA LOCAL INFILE "C:/my_file.csv" INTO TABLE my_table CHARACTER SET UTF8 FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY ',' LINES TERMINATED BY '\r\n';
Hope this helps someone.