Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 3849  / 2 Years ago, thu, october 20, 2022, 11:52:18

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.


More From » mysql

 Answers
6

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.


[#29814] Thursday, October 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
epypian

Total Points: 130
Total Questions: 111
Total Answers: 113

Location: Romania
Member since Mon, Jun 6, 2022
2 Years ago
epypian questions
Sat, Jul 31, 21, 18:35, 3 Years ago
Sun, Oct 24, 21, 23:28, 3 Years ago
Sun, Dec 26, 21, 12:08, 2 Years ago
Tue, May 9, 23, 21:23, 1 Year ago
;