简体   繁体   中英

can't load_file data in the mysql directory

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?

In order for load file to work make sure that all permissions are granted for the MySQL owner and group.

chown mysql:mysql /var/lib/mysql/foo/*
chmod go+rw /var/lib/mysql/foo/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM