LOAD DATA INFILE Syntax Error?
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>