faqts : Computers : Databases : MySQL : Language and Syntax : Queries : Load Data

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

206 of 263 people (78%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

Why do I get "Can't get stat of 'test.txt' (Errcode: 2)" when using LOAD DATA INFILE?

Dec 29th, 2000 12:53
Vikas Wadhwani, Nathan Wallace,


This means the file doesn't exist.  The trick is that MySQL looks
for files in its data directory.  You need to specify the full path
to the file:

    LOAD DATA INFILE '/path/to/test.txt' ...

Or, you could use the LOCAL specifier to tell MySQL to load the file
through the client, instead of directly into the server:

    LOAD DATA LOCAL INFILE 'test.txt' ...

This second option isn't quite as efficient, but it will work even if
you are not on the same machine as the server, or if you don't have
FILE privileges.

None of the above really worked for me.What did work was a combination
of the two.You could try LOAD DATA LOCAL INFILE '/path/to/test.txt'...
this may work if the above two don't.