MySQL Forums
Forum List  »  Newbie

LOAD DATA INFILE Syntax Error?
Posted by: Danie Bosman
Date: June 20, 2023 02:31PM

Hi. Rank newbie !!! Not sure if I'm doing this right at all.
I have responded to a similar post, but it was not quite the same in context, ad was already posted in 2033, so I have created a new thread.
Should I have done this differently?
In short, I have Google'd the command-line instruction to use, but when I enter the command on the command-line, I get a Syntax error message, and the command fails.
I could, however, import the exact same CSV file, using both PhpMyAdmin and MySQL Workbench?
I am Using UBUNTU 22.04 LS, MySQL 8.0.33.
I first created the required table, and am now trying to populate the table with data that is available in, and from, a spreadsheet (I extracted the required information for the specific table, into a specific sheet for each table).
My command is:
LOAD DATA INFILE '/home/djb/Documents/_libre_office/_calc/SchoolsDatabaseExportAsCSVSchoolsTable.csv'
INTO TABLE schools
IGNORE 1 LINES
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(schools_id, name, addr_towncity, addr_province, description);

The response is:ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(schools_id, ' at line 4
mysql>

Options: ReplyQuote


Subject
Written By
Posted
LOAD DATA INFILE Syntax Error?
June 20, 2023 02:31PM


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.