0

I am having problems trying to load my .csv file into MySQL on my Centos box. My file is called 'OD_Orders.csv' is located in my home directory called /home/kam/KamSQLData

The error I get when I tried to load up the file into MySQL is:

mysql> LOAD DATA LOCAL INFILE '/home/kam/KamSQLData/OD_Orders.csv' INTO TABLE orders FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; ERROR 13 (HY000): File '/home/kam/KamSQLData/OD_Orders.csv' not found (Errcode: 13)

I did some reading and the usual culprit is Unix permissions are off or wrong. I than proceed to create a group (called KamSQLData) so the userid of 'mysql' and 'kam' can share the group on /home/kam/KamSQLData:

KamSQLData:x:512:mysql,kam

I then proceed to set /home/kam/KamSQLData as the group of 'KamSQLData', thinking both kam and mysql will have access to it.

-rwxr-xrwx.  1 root KamSQLData     2322 Feb 15 14:03 OD_Orders_2019-01-28.csv
-rwxr-xrwx.  1 root KamSQLData     5282 Feb 15 14:03 OD_Orders_2019-01-25.csv
-rwxr-xrwx.  1 root KamSQLData     4428 Feb 15 14:03 OD_Orders_2019-01-24.csv
-rwxr-xrwx.  1 root KamSQLData     9784 Feb 15 14:03 OD_Orders_2019-01-23.csv
-rwxr-xrwx.  1 root KamSQLData     3795 Feb 15 14:03 OD_Orders_2019-01-22.csv
-rwxr-xrwx.  1 root KamSQLData    11004 Feb 15 14:03 OD_Orders_2019-01-18.csv
-rwxr-xrwx.  1 root KamSQLData     3528 Feb 15 14:03 OD_Orders_2019-01-17.csv
-rwxr-xrwx.  1 root KamSQLData     5655 Feb 15 14:03 OD_Orders_2019-01-16.csv
-rwxr-xrwx.  1 root KamSQLData     2959 Feb 15 14:03 OD_Orders_2019-01-15.csv
-rwxr-xrwx.  1 kam  KamSQLData 27084955 Feb 15 14:21 OD_Orders.csv
drwx------. 12 kam  kam            4096 Feb 15 14:21 ..
drwxr-srwx.  2 root KamSQLData    20480 Feb 15 14:36 .

Than i went ahead and set the following to my directory:

sudo chmod -R 2775 /home/kam/KamSQLData/

  • Comments are not for extended discussion; this conversation has been moved to chat. – terdon Feb 20 '19 at 17:43
0

I ended taking the suggestion of Haxiel, where is never a good idea to make changes to the home directory (since everyone creation account(s) starts there). I placed my source data folder on /tmp and it already had the proper permission on that folder already (though I did run chmod -R 2775 to make sure). I was able to Load my .csv file(s) from that directory without modifying anything on SELinux or the home directory permission.

|improve this answer|||||

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.