List:General Discussion« Previous MessageNext Message »
From:Dave Fogle Date:July 28 2001 1:47pm
Subject:errcode 2 message with "load data local infile"
View as plain text  
Thanks for reading this - I have searched all the MySQL info I can find as
well as the web at large, but nobody seems to have offered a real answer to
the following problem, which many have had, though possibly only with Win32
client machines accessing UNIX servers:

The problem arises when trying to populate a table on a server (in my case a
Sun box) with data from a delimited text file from a client machine (in my
case located in the root of the C: drive on a Win32 machine).   Using the
command "LOAD DATA LOCAL INFILE "filename.txt" INTO TABLE tablename;"
results in the error: "File 'filename.txt' not found (Errcode: 2)"

Now, let me point out that I actually got this to work at one point, by
putting the files in the root of my C: drive and using just the filename
with no path info. The files were found and uploaded and the tables filled
with perfect data. So, I copied and pasted each command line (I had several
to populate) into a text file for later use, since I thought I had hit on
the magic solution.

But, when I tried a week later to use these exact same commands with the
same files in the same places, they didn't work. I rebooted my Win32 machine
in case that mattered (it didn't) and then went hunting for the solution (I
haven't found it).

Is there an environment variable or something similar that tells where MySQL
is going to look by default on the local machine? Or do you know of some
setting on Win32 machines that would confuse the issue of what is the root?
I know these are vague questions, but they're all I've got.

Some of the suggested solutions I have found are reasonable as well as being
supported by notes in the documentation, but they don't work. Examples are
suggestions result in attempts such as "c:\filename.txt" or
"C:\\FILENAME.TXT" or "C:/filename.txt" or "/filename.txt" but the problem
persists despite the fact that the file is WITHOUT A DOUBT in this location.

Others suggest abandoning the command in favor of the mysqlimport utility,
or uploading the file to the server and then using "LOAD DATA INFILE", which
sidesteps the "LOCAL" problem. But, from what I have read, these both
require specific permissions that not everyone has, and anyway this seems
more like running away from the problem than solving it.

Thanks for listening
errcode 2 message with "load data local infile"Dave Fogle28 Jul
  • Re: errcode 2 message with "load data local infile"Sinisa Milivojevic28 Jul
Re: errcode 2 message with "load data local infile"Dave Fogle28 Jul
  • Re: errcode 2 message with "load data local infile"Sinisa Milivojevic29 Jul