Here's the question, as succinctly as I can formulate it:


The documentation seems to say that one can load a tab-delimited text file located in the current directory of the client host into a database by running the client mysql and executing the following command:

mysql> LOAD DATA LOCAL INFILE "absence.txt" into table absence;

When "absence.txt" is located in "/Users/jack/Desktop/SQL_stuff/samp_db/", then the command:

mysql> LOAD DATA LOCAL INFILE "/Users/jack/Desktop/SQL_stuff/samp_db/ absence.txt" into table absence;

does work.

But the command:

mysql> LOAD DATA LOCAL INFILE "absence.txt" into table absence;

does not work. Rather, it produces the error:

ERROR:
File 'absence.txt' not found (Errcode: 2)

That is, absolute pathnames work, but relative pathnames do not.

I have been careful to be sure that, when invoking the mysql client, I am in the correct directory, and that when I invoke mysql, that I include the --local-infile option, as the following printout shows:

[Jacks-G4:~/Desktop/SQL_stuff/samp_db] jack% mysql --local-infile samp_db

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14 to server version: 3.23.52-entropy.ch

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> LOAD DATA LOCAL INFILE "absence.txt" into table absence;
ERROR:
File 'absence.txt' not found (Errcode: 2)

I have concluded that one cannot use the relative pathname of a file in the LOAD DATA LOCAL INFILE command. I hope I am wrong, as it would be nice to use the simpler, relative, pathname.

Am I wrong or right? If wrong, what am I missing?


Jack Connolly
Hanover, MA
[EMAIL PROTECTED]


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to