I’m trying to import data into a table from a .csv file, but mysql is having a hard time finding it. When I just have it in my C drive, not in a folder, it finds it fine. When I place the file I want in a folder, then put the file path in my query, it doesn’t work.
The query I’m using is:
load data local infile ‘/C:\file_path’
into table table_name
fields terminated by ‘,’
enclosed by ‘”‘
lines terminated by ‘\n’
ignore 2 lines;
I have also tried removing ‘local’ to no avail
Thanks!
By default (i.e. unless the
NO_BACKSLASH_ESCAPESSQL mode is enabled), you have to escape backslash characters in string literals.As documented under
LOAD DATA INFILESyntax:Therefore, use either:
Or: