Reputation: 14404
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?
Upvotes: 4
Views: 18514
Reputation: 111
I was having the same problem
'C:/Program Files/DatabaseTableHolders/Menu.csv'
The first thing I did was move the files to the "Program File" directory It still wouldn't work
Then I changed the path address from
'C:/Program Files/DatabaseTableHolders/Menu.csv'
to
'C:\Program Files\DatabaseTableHolders\Menu.csv'
THIS WORKS!!!
For me its something to do with the path structure.
By the way I'm using Eclipse and phpMyAdmin on WAMP (windows operating system). I hope this helps.
Upvotes: 2
Reputation: 1
It is best if you put that text file in 'xammp /phpMyAdmin ' directory ( I assume you work on xammp) That's it. then LOAD DATA LOCAL INFILE will work. Happy Coding
Upvotes: 0
Reputation: 145
Yes, I meet the same error. My situation: XAMPP + MAC OS 10.9
load data local infile '/Applications/XAMPP/xamppfiles/htdocs/jsonSQL.txt' into table `ttlegs` fields terminated by ',' lines terminated by '\n'
and this works when I put jsonSQL.txt to htdocs.
Upvotes: 0
Reputation: 91
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';
Upvotes: 9
Reputation: 569
I have had the same issue, trying to import an SQL file that uses LOAD DATA LOCAL INFILE... to import a CSV file in phpMyAdmin and got the same error message: #7890 - Can't find file 'myfile.csv'
The solution I found was to put the file in the same folder as phpMyAdmin.
Upvotes: 2
Reputation: 14404
I'm not too sure what the problem is but I made it work by moving the file to /tmp/test_data
and used LOAD DATA INFILE...
Upvotes: 2