MySQL Forums
Forum List  »  Newbie

Re: LOAD DATA INFILE Syntax Error?
Posted by: Barry Galbraith
Date: June 20, 2023 06:47PM

The refman here
https://dev.mysql.com/doc/refman/8.0/en/load-data.html
shows the IGNOR clause coming after the LINES TERMINATED BY clause.

LOAD DATA INFILE '/home/djb/Documents/_libre_office/_calc/SchoolsDatabaseExportAsCSVSchoolsTable.csv'
INTO TABLE schools
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(schools_id, name, addr_towncity, addr_province, description);

I haven't tested the code.
I assume that your user has FILE privilege, and that the file is to be read from the secure folder
https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_secure_file_priv

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: LOAD DATA INFILE Syntax Error?
June 20, 2023 06:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.