1

I'm trying to import a .csv file in mysql workbench by writing a script vs. using the Table data import wizard.

I have tried the following script:

LOAD DATA LOCAL INFILE `/path/table_one.csv`
INTO TABLE Datatest.Table_one
FIELDS TERMINATED BY `,`
ENCLOSED BY `"`
LINES TERMINATED BY `\n`
IGNORE 1 ROWS;

But I am getting the following syntax error:

Error Code: 1064. 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 '`/path/table_one.csv` INTO TABLE Datatest.Table_one FIELDS TERMIN' at line 1

Any ideas on what the syntax error might be?

Dan
  • 1,238
  • 2
  • 17
  • 32
Lylia
  • 13
  • 3

1 Answers1

0

Please use single ticks and not backticks

LOAD DATA LOCAL INFILE '/path/table_one.csv'
INTO TABLE Datatest.Table_one
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;

and please read When to use single quotes, double quotes, and backticks in MySQL

nbk
  • 45,398
  • 8
  • 30
  • 47