#### Archived

This topic is now archived and is closed to further replies.

## Recommended Posts

mysql> LOAD DATA LOCAL INFILE \"pet.txt\" INTO pet;

Could somebody please tell me where the data file \"pet.txt\" has to be for the above instruction to work?

##### Share on other sites

mysql> LOAD DATA LOCAL INFILE \"pet.txt\" INTO pet;

with that I believe you have to have the pet.txt in the same directory the mysql program is running in. a better way to do it would be like

mysql> LOAD DATA LOCAL INFILE \"/path/to/file/pet.txt\" INTO pet;

and make sure the permissions are set so mysql can access it.

if your running on windows then I think the path needs to be something like

mysql> LOAD DATA LOCAL INFILE \"C:\\path\\to\\file\\pet.txt\" INTO pet;

hope that helps

##### Share on other sites

How have you stored the value sin the text files

meaning

How are the fields seprated and how are the records seprated.

If you have it as CSV comma seprated vlaues you can try this

LOAD DATA INFILE \'C:\\pet.txt\' INTO TABLE pet FIELDS TERMINATED BY \',\' LINES TERMINATED BY \'n\';