0

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 ?

Pierre
  • 429
  • 1
  • 5
  • 14

1 Answers1

0

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

/etc/apparmor.d/usr.sbin.mysqld

apparmor was restarted:

/etc/init.d/apparmor restart

and now my UDF works fine ! :-)

Pierre
  • 429
  • 1
  • 5
  • 14