MySQL Forums
Forum List  »  Newbie

Re: Load Data Local Infile not Working
Posted by: Danie Bosman
Date: June 20, 2023 02:25PM

Hi. Rank newbie !!! Not sure if I'm doing this right at all.
Mine is not a solution to OP's question, but my own concern trying to import data.
Is this the right place to post it?
In short, I have Google'd the command-line instruction to use, but 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
Re: Load Data Local Infile not Working
June 20, 2023 02:25PM


Sorry, only registered users may post in this forum.

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.