1

I have a SQL script that contains the following

LOAD DATA LOCAL INFILE '.\\datafiles\\customers.txt' INTO TABLE Customers`

I open and run it in MySQL workbench and I get following error:

Error Code: 2. File '.\datafiles\customers.txt' not found 
  (Errcode: 2 - No such file or directory)

Where should I put file customers.txt according '.\datafiles\customers.txt'?

I use windows 7 and I tried the following placse:

  1. C:\datafiles
  2. C:\temp\datafiles
  3. C:\tem\datafiles
  4. C:\Users\michael\datafiles

2 Answers 2

1

I think \\ is incorrect. I Always use full path.

So if the file is in C:\datafiles\ use

LOAD DATA LOCAL INFILE 'C:\datafiles\customers.txt' 
INTO TABLE Customers LINES TERMINATED BY '\r\n';
Sign up to request clarification or add additional context in comments.

3 Comments

\\` is correct because when i change it to 'C:\\datafiles\\customers.txt'` it works fine.
Can i ask why you use double \?
I did not use double \. It is in the sql script which i get it from developer company and i'm not allowed to change it. just i should know where is the correct location of file on my computer.
0

Use absolute path with slash as a separator like this:

'C/your_folder/.../datafiles/customers.txt'

2 Comments

i don't want to change anything in the sql script. i should just put the file in the correct location in windows.
Maybe you should try to put your file in your SQL installation folder. Create the datafiles folder in there and see if it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.