Joinutility seperatorLogin utility separator Infobright.com
   
 
files created by INTO OUTFILE only has 660 permission?
Posted: 23 July 2010 09:16 AM   Ignore ]  
Newbie
Rank
Total Posts:  1
Joined  2010-05-30

Hi guys,

From MySQL document, any files created by INTO OUTFILE is writable by all users, but I only get the 660 permission when using above command:

-rw-rw---- 1 mysql mysql        140 Jul 21 14:05 test.out 

Therefore, I got following error when loading file back:

The file ‘test.out’ must be in the database directory or be readable by all

The permission of directory contains output file:

drwxr-xr-x 2 mysql mysql 4096 Jul 21 14:08 mysqldata

Even when I created it in database directory, I got the another error:

mysqlload data infile '/usr/local/infobright/outfile/test.out' into table xx;
 
ERROR 13 (HY000): Can't get stat of '/usr/local/infobright/outfile/test.out (Errcode2

Only when executing chmod o+r, I can LOAD DATA INFILE successful.

Any help will be appreciated.

PS: LOAD DATA LOCAL INFILE works fine on my server itself.

Profile
 
Posted: 29 July 2010 09:35 AM   Ignore ]   [ # 1 ]  
Sr. Member
Avatar
RankRankRankRank
Total Posts:  454
Joined  2008-08-18

Hi,

All files read/written by SELECT ... INTO OUTFILE and LOAD… DATA INFILE are processed by the mysqld process, and inherit the userid and permissions and umask of the user running mysqld (normally “mysql”).

If you want to change the file mode on the files created by SELECT ... INTO OUTFILE, simply change the umask in the user profile of the user “mysql”. This can be done by putting the command:

umask 000 

in the .bashrc (or .bash_profile) of the user “mysql”‘s home directory.

Geoffrey

Signature 
Profile
 
   
 
 
‹‹ Cast & OutFile      Which TB? ››