At 21:42 -0500 1/21/03, Stephen Tiano wrote:
Okay, I found User Comments at the end of the section of the user manual online that contained the info I needed to get the option of loading a textfile into a table.

The startup line I use for that is:

/usr/local/bin/mysql -u root --local-infile -p menagerie

where 'menagerie' is the database that has the table into which I want to load data.

Observation: I guess there's no way to just give myself a 'free pass' to be able to load data into any database. It appears I have to name a particular database right at the start.
Well, sure.  If you don't name a database at some point, where would
you expect the data to be loaded?  The server won't just pick a database
for you -- that wouldn't be a good policy. :-)

Anyway ... Then, of course, I do a

   USE menagerie
Unnecessary if you've named menagerie on the command line (which it looks
like you did).


Now I want toL in the textfile called pet.txt, which I downloaded from the MySQL website at http:.//www.mysql.com/Downloads/Contrib/Examples/menagerie.zip, into the table pet which now resides in my Sites folder. So I issue the command

LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet;

and, for the first time, I am not denied LOADing DATA privileges. I do, however, get to read:

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

What's up with that? I checked the folder 'menagerie' in the Sites folder. pet.txt is most definitely there, and it contains comma delimited rows to go with the tutorial table I'm working at.
You must name the path to the file as it would be found beginning from
your current directory.  If you're in the Sites/menagerie directory, then
the statement should work as you've shown it.  If not, name the path to the
file.  For example, if you're in the parent directory of the Sites directory,
the statement would be

LOAD DATA LOCAL INFILE 'Sites/menagerie/pet.txt' INTO TABLE pet;


But it'd sure help top know what's going on now with trying to load data from a textfile.

Steve Tiano

---------------------------------------------------------------------
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