469,159 Members | 1,512 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,159 developers. It's quick & easy.

load_file() problem

I'm running as mysql root user on my system.

I can select load_file('/etc/passwd'); no problem

But when I try to select load_file('/var/lib/mysql/mysql'); I get NULL as a result why? this file is good, I can cat it as root and view the mysql user data, why cant mysql load_file it? Its permissions are the default:

-rw-rw---- 1 mysql mysql 444 2009-08-04 19:08 user.MYD

It's owner is by default the user mysql and has read permission, so why doesn't mysql like to load_file it? Is mysql somehow blocking access to this file and if so how can I bypass that? Doing stuff like mysql/../mysql in the path doesn't work, and using hex encoding didn't work either?
Nov 29 '09 #1
2 9600
Atli
5,058 Expert 4TB
Hey.

You say you are trying to load a file called "/var/lib/mysql/mysql" but your ls output lists a file named "user.MYD". Could you simply have typed in the wrong path?

If not, consider this, from the manual:
The file must be readable by all and its size less than max_allowed_packet bytes.
It says "readable by all". Perhaps you need to CHMOD the file to 664? (Or otherwise readable by everybody.)

The max_allowed_packet directive could of course also be messing with your code. Worth checking.
Nov 30 '09 #2
You need to grant the MySQL FILE privilege to the user. Note that this is a GLOBAL permission. It allows the user to access all files that MySQL has permissions to.

You can set it with the command:

GRANT FILE ON *.* TO person@'<host>';
Apr 5 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by mike w. | last post: by
reply views Thread by nouno | last post: by
3 posts views Thread by Mike Krueger | last post: by
2 posts views Thread by Bonzo | last post: by
reply views Thread by Christian Stapfer | last post: by
reply views Thread by =?Utf-8?B?cmFuZHkxMjAw?= | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.