Linux/MySQL Permission Problem: ERROR 13 (HY000): Can't get stat

Hello,

I use Linux (CentOS) to run my web server, and I use MySQL for the database.

I need to do the following from a mysql command line:
         LOAD DATA INFILE '/home/mydir/dump.txt' INTO TABLE my_db.table FIELDS TERMINATED BY '||';

But I get the following error:
        ERROR 13 (HY000): Can't get stat of '/home/mydir/dump.txt' (Errcode: 13)

I think the problem is that MySQL does not have permission to access '/home/mydir/dump.txt'.

I changed both the owner and the group for '/home/mydir/dump.txt' to 'nobody' and I change its permission to 777 but I still get the error!

Please help!
Thanks!
LVL 16
hankknightAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WarpsehCommented:
Instead of LOAD DATA INFILE try load data LOCAL infile :)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
NopiusCommented:
The difference between LOCAL and not LOCAL is in user id of the loading program.
http://dev.mysql.com/doc/refman/5.1/en/load-data.html

if LOCAL it's a 'mysql' (typically) user, if not LOCAL it's the owner of the current process (by default 'nobody' if apache, or current user it you are using 'mysql' command line).

So if you load from your mysql command, I agree with Warpseh, use LOCAL.

If you like this command to be working without 'LOCAL', change permissions to your home directory: 'chmod 755 /home/mydir' to be readable by others.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.