0

For the past 2 days, I have been trying to load data from a CSV file into a mySQL database. At first, I encountered the secure file priv error, which didn't go away when I changed my file location, or when I commented out the relevant line in "my.ini". When I eventually resolved that by changing its value to an empty string, I discovered that I still couldn't load the file as I was getting OS errno2 no such file or directory.

LOAD DATA INFILE "C:/Users/ehize/Downloads/not414.csv" 
INTO TABLE birthrate 
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;

I don't know if this makes any difference, but I'm hosting this mysql server on my system. I have also tried the LOAD DATA LOCAL, but it makes no difference as \I get the same file not found error. Honestly at my wits end here. Everyone online just talks about changing backslashes to front-slashes or double back-slashes, none of which make any difference. Please help of any form would be appreciated.

  • make sure the '--secure-file-priv' option is turned off, see: https://stackoverflow.com/questions/37596163/disable-secure-priv-for-data-loading-on-mysql – Luuk Nov 28 '21 at 15:29
  • Did you also check if the file is really at that location, using: `\system dir "C:\Users\ehize\Downloads\not414.csv"` ? – Luuk Nov 28 '21 at 15:36
  • In the end, I think the issue was with my table column data types – jamesnottidge Dec 10 '21 at 20:20
  • No, this would lead to other error messages, and not to the error you where reporting ... ("OS errno2 no such file or directory") – Luuk Dec 11 '21 at 09:54
  • So what would lead to that error? – jamesnottidge Jan 06 '22 at 19:51
  • In order to get an answer which will help you you need to make the question in a [mre]. Post a minimal input file, which will lead to the error reported. – Luuk Jan 07 '22 at 07:23

0 Answers0