SELECT INTO OUTFILE fails for a CIFS-mounted directory (
/mnt/backup/test) but works for a normal directory (
mysql> select * from mytable into outfile '/tmp/tests/mytable.txt'; Query OK, 3723 rows affected (0.05 sec) mysql> select * from mytable into outfile '/mnt/backup/test/mytable.txt'; ERROR 1 (HY000): Can't create/write to file '/mnt/backup/test/mytable.txt' (Errcode: 2)
mysql user has no problem writing to
root:~# su - -s /bin/bash mysql mysql:~$ touch /mnt/backup/test/mytable.txt mysql:~$ ls -l /mnt/backup/test/mytable.txt -rw-r--r-- 1 root root 0 2009-11-16 10:48 /mnt/backup/test/mytable.txt
The CIFS directory
/mnt/backup is mounted with :
-T option of
mysqldump makes use of it, what options (Mysql/CIFS) are needed for
SELECT INTO OUTFILE to work with my CIFS-mounted directory ?
strace of the
mysqld process did indeed reveal a access control failure as Michael suggested. But I still don't know why. A simple Perl script launched as
mysql calls the same syscall with no problem.
Extract of mysqld strace
open("/mnt/backup/tests/bugs.1.txt", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0666) = -1 EACCES (Permission denied)
Extract of perl strace
open("/mnt/backup/tests/bugs.32064.txt", O_WRONLY|O_CREAT|O_EXCL|O_LARGEFILE, 0666) = 3
Note that the directory
/mnt/backup/tests was emptied before each run.