Re: Load Data Local Infile not Working
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>