MySQL Problem
this is my problem (maybe is easyly solvable):
I'm trying a query like this:
markupSELECT "test" INTO DUMPFILE "/var/www/images/test.tst"
But i don't have permission to write into that file:
MySQL said: #1 - Can't create/write to file '/var/www/images/test.tst' (Errcode: 13)
I've chmodded the dir to 777 and chowned it to mysql.mysql:
chown: drwxrwxrwx 2 mysql mysql 4096 2009-02-25 17:54 images stat: File: `images/' Size: 4096 Blocks: 8 IO Block: 4096 directory Device: 801h/2049d Inode: 1401177 Links: 2 Access: (0777/drwxrwxrwx) Uid: ( 112/ mysql) Gid: ( 125/ mysql) Access: 2009-02-25 17:54:33.000000000 +0100 Modify: 2009-02-25 17:54:33.000000000 +0100 Change: 2009-02-25 17:54:43.000000000 +0100
Can someone help with this?
try using "INTO OUTFILE" instead of "INTO DUMPFILE". post what happens.
also, reference this: http://dev.mysql.com/doc/refman/5.1/en/select.html, find (ctrl+f) "INTO DUMPFILE" on that page, 2nd result, read the notes.
Yo guys, got it! :D
This is my solution:
-
edit "/etc/mysql/my.cnf"
markup# vi /etc/mysql/my.conf
-
change the "tmpdir" variable to "/var/www/images"
-
if u use apparmor edit "/etc/apparmor.d/usr.sbin.mysqld"
markup# vi /etc/apparmor.d/usr.sbin.mysqld
-
add this lines:
/var/www/images/** rwk,```
5. restart mysql and apparmor with ```markup/etc/init.d/mysql reload && /etc/init.d/apparmor reload```
If u have a better solution, please let me know.