Jump to content

Loading data from a local infile


fredpickwick

Recommended Posts

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

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\';

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.