Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

this is question I already asked on SO but I wonder if this could be a SysAdmin problem.

I'm trying to create a mysql UDF function , this function calls "fopen/fclose" to read a flat file stored in /data. But using errno (yes, I know it is bad in a MT program...) I can see that the function cannot open my file:

"Permission denied"

I tried to do a

chmod -R 755 /data (as well as 777, chown -R mysql:mysql /data etc...)

but it didn't change anything.

when I copied the flat file to /tmp : OK, my UDF was able to 'fopen' the file. I'm puzzled.

currently , I've got:

drwxrwxrwx 4 pierre root 4096 2010-05-26 16:51 /data
drwxrwxrwx 3 pierre root 4096 2010-05-18 09:41 /data/dir1
drwxrwxrwx 3 pierre root 4096 2010-05-18 09:41 /data/dir1/dir2
drwxrwxrwx 4 pierre root 4096 2010-05-18 10:27 /data/dir1/dir2/dir3
-rw-r--r-- 1 pierre root 50685268 2005-12-10 00:01 /data/dir1/dir2/dir3/myfile.txt

Any idea ?

share|improve this question
up vote 0 down vote accepted

mysqld was protected by apparmor.

AppArmor represents one of several possible approaches to the problem of restricting the actions that installed software can take.

I added

/data/** r,

at the end of


apparmor was restarted:

/etc/init.d/apparmor restart

and now my UDF works fine ! :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.