MySQL Forums
Forum List  »  General

Permissions error with SELECT INTO OUTFILE
Posted by: Ryan Olson
Date: May 28, 2010 11:41AM

I can run this query:

select column1
INTO OUTFILE '/data/mysql/test.csv'
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\n'
from test;

And I get my file in /data/mysql. (This is my datadir)

However, when I try to write into another directory, I get an error:


mysql> select column1 INTO OUTFILE '/data/tmp/test.csv' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from test ;
ERROR 1 (HY000): Can't create/write to file '/data/tmp/test.csv' (Errcode: 13)
mysql>

Even though /data/tmp is owned by mysql:mysql and has write permissions:


mysql@server:~$ cd /data
mysql@server:/data$ ls -al
total 72
drwxrwxrwx 14 mysql mysql 4096 2010-05-27 18:09 .
drwxr-xr-x 24 root root 4096 2010-05-24 17:07 ..
...
drwxrwxr-x 16 mysql mysql 4096 2010-05-28 13:28 mysql
...
drwxrwxr-x 2 mysql mysql 4096 2010-05-28 10:24 tmp
mysql@server:/data$ touch tmp/test
mysql@server:/data$ ll tmp
total 8
drwxrwxr-x 2 mysql mysql 4096 2010-05-28 13:35 .
drwxrwxrwx 14 mysql mysql 4096 2010-05-27 18:09 ..
-rw-r--r-- 1 mysql mysql 0 2010-05-28 13:35 test
mysql@server:/data$

Is there any other setting in mysql that is not allowing me to write into directories other than datadir and tmpdir?

Options: ReplyQuote


Subject
Written By
Posted
Permissions error with SELECT INTO OUTFILE
May 28, 2010 11:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.