Follow us on Twitter!
Few are those who can see with their own eyes and hear with their own hearts. - Albert Einstein
Wednesday, April 16, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 11
Guests Online: 11
Members Online: 0

Registered Members: 82800
Newest Member: santana1744
Latest Articles
View Thread

HellBound Hackers | Computer General | General Computer Problems

Author

MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-02-09 17:33
this is my problem (maybe is easyly solvable):
I'm trying a query like this:
Code
SELECT "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?


Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-02-09 17:34
ah, another thing, if i use
Code
SELECT "test" INTO DUMPFILE "/tmp/test.tst"



it works.


Author

RE: MySQL Problem

spyware
Member



Posts: 4192
Location: The Netherlands
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 25-02-09 17:50
Did you chmod the dir + all the files in there? Try chmodding the file you're writing to.



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
“Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?” - Ebert
[/s
http://bitsofspy.net
Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-02-09 17:58
Yes, but i got this error:
ERROR 1086 (HY000): File '/var/www/images/file.txt' already exists
...
Anyway, i don't need to append to a file, i need to write a new file with some info...


Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 26-02-09 02:56
try using "INTO OUTFILE" instead of "INTO DUMPFILE". post what happens.

also, reference this: http://dev.mysql.. . .elect.html, find (ctrl+f) "INTO DUMPFILE" on that page, 2nd result, read the notes.
Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 26-02-09 13:55
I got the same error Sad


Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 26-02-09 14:29
what i would do is to allow mysql to write into /var/www/images/


Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 27-02-09 03:11
mysqld should be running as www-data, so use:

chown -R www-data.www-data /var/www/images/

and see what happens then?


Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 27-02-09 14:04
jjbutler88 wrote:
mysqld should be running as www-data, so use:

chown -R www-data.www-data /var/www/images/

and see what happens then?


I had already tried that way, but unfortunately it doesn't work


Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-09 16:46
Yo guys, got it! :D

This is my solution:

1. edit "/etc/mysql/my.cnf"
Code
# vi /etc/mysql/my.conf



2. change the "tmpdir" variable to "/var/www/images"

3. if u use apparmor edit "/etc/apparmor.d/usr.sbin.mysqld"
Code
# vi /etc/apparmor.d/usr.sbin.mysqld



4. add this lines:
Code
/var/www/images/ r,
/var/www/images/** rwk,



5. restart mysql and apparmor with
Code
/etc/init.d/mysql reload && /etc/init.d/apparmor reload




If u have a better solution, please let me know.


Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-09 18:37
good job Cyph3r Wink


Author

RE: MySQL Problem


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 01-03-09 20:38
thanks man Smile