0

Im having trouble importing the text file from my desktop into the database,i tried it both ways but it doesn't seem to work, does the file have to be somewhere specifically for it to import. please help

load data local infile 'userdata_import.txt' into table tags fields terminated by ',' lines terminated by '\n';

load data local infile 'C:\Users\duy\Desktop\userdata_import.csv' into table tags
    -> fields terminated by ',' lines terminated by '\n';
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by isharra
0

I'm assuming you've already checked that local-infile is allowed for both the client and the server.

The path for the file is relative to where the mysql client is started. Since it looks like you're using Windows that's probably not where you're keeping your files so using full path instead of relative path is best.

Use forward slashes '/' or double backslashes '\\' in the filename for windows. Single backslashes are escape characters.

LOAD DATA LOCAL INFILE 'C:/Users/duy/Desktop/userdata_import.csv' INTO TABLE tags FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
or
LOAD DATA LOCAL INFILE 'C:\\Users\\duy\\Desktop\\userdata_import.csv' INTO TABLE tags FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';

Edited by isharra: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.