Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL cannot find data file for a load operation

I would like to load a data file into MySQL using the following command:

LOAD DATA LOCAL INFILE '/Users/David/Desktop/popularity20110511/test_data' INTO TABLE test_table

The above command gives me the following error:

#7890 - Can't find file '/Users/David/Desktop/popularity20110511/test_data'.

I've also tried:

LOAD DATA INFILE '/Users/David/Desktop/popularity20110511/test_data' INTO TABLE test_table

I also gives me an error:

#13 - Can't get stat of '/Users/David/Desktop/popularity20110511/test_data' (Errcode: 13)

I've repeatedly checked the file path and name and I've also made sure the file privilege is set to Read & Write for everyone.

I am using a Mac and phpMyAdmin.

Any suggestions on what the problem may be?

like image 762
David Avatar asked Dec 09 '22 08:12

David


1 Answers

I had the same problem using MacOs and tried to change permissions, etc, but I realized you have to use the same directory structure you have using in the Terminal Application. Example: if you have (localhost/myproject/myfile.csv) try using

(Applications/XAMPP/htdocs/myproject/myfile.csv).
LOAD DATA LOCAL INFILE '/Applications/XAMPP/htdocs/myproject/myfile.csv' 
INTO TABLE `mytable` 
FIELDS TERMINATED BY ';'
LINES TERMINATED BY '\r';
like image 110
Alexandre Crivellaro Avatar answered Dec 22 '22 02:12

Alexandre Crivellaro