The MySQL Manual states the following in the LOAD DATA INFILE section :- If a filename with no leading components is given, the server looks for the file in the database directory of the current database.
-----Original Message----- From: John Connolly [mailto:[EMAIL PROTECTED]] Sent: 28 November 2002 14:12 To: [EMAIL PROTECTED] Subject: LOAD DATA LOCAL INFILE Hello all --- I posted this yesterday, perhaps before my subscription took effect, and so I am not sure that it got distributed. So, forgive the repetition in sending, if that's the case. Anyway . . . 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. With thanks for your replies, am I wrong or right? If wrong, what am I missing? Jack Connolly Hanover, MA [EMAIL PROTECTED] Running, on Mac OS 10.2, server and client on same machine: +--------------------+ | version() | +--------------------+ | 3.23.52-entropy.ch | +--------------------+ --------------------------------------------------------------------- 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 BBCi at http://www.bbc.co.uk/ This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated. If you have received it in error, please delete it from your system, do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately. Please note that the BBC monitors e-mails sent or received. Further communication will signify your consent to this. --------------------------------------------------------------------- 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