1

I have a text file which i would want to load into mysql database on Ubuntu server 12.04 LTS. I have entered the data into the file trey.txt and i moved the file to /tmp directory. When i move to the db, and enter the command

LOAD DATA
INFILE '/tmp/trey.txt'
into table arp_table
columns terminated by '|';

the output is

 ERROR 13(HY000):Can't get stat of '/tmp/trey.txt'(Errcode: 2)

How should i modify to enter these details. And can i run this from command line as a cron job.

1

The problem i was having was that for security reasons, local data offloading is disabled by default , and for the file to be read into the database, it must be enabled by starting mysql using

mysql -uroot -ppassword --local-infile database

This will solve the problem and you can insert from a text file.

0

Put your data fine in root folder in ubuntu after that run this command as admin:-

$ sudo mysql -u root -p <database name>

mysql> LOAD DATA LOCAL INFILE '/path/trey.txt' INTO TABLE pet;

if 'path/trey.txt' is not working then use '../path/trey.txt'

  • that's what the user was already doing... – Thufir Aug 19 '14 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.