sql - MySQL LOAD_FILE returns NULL -
i want sql load_file function work , have read every single question/answer + documentation this, here what's been happening.
when want load_file home directory:
mysql> select load_file('/home/myuser/somefile.txt'); +----------------------------+ | load_file('/home/myuser/somefile.txt') | +----------------------------+ | null | +----------------------------+ 1 row in set (0.00 sec)
so after getting this, thought maybe problem mysql cannot access home directory. , tried running this, worked fine:
select load_file('/etc/mysql/my.cnf');
then select load_file('/etc/passwd');
worked fine well.
so said gotcha, it's file/folder read/ownership permission problem. so, moved file /etc/mysql/ still didn't work. i've tried chown mysql:mysql somefile.txt
still, had no luck:
mysql> select load_file('/etc/mysql/somefile.txt'); +----------------------------+ | load_file('/etc/mysql/somefile.txt') | +----------------------------+ | null | +----------------------------+ 1 row in set (0.00 sec)
p.s. 1. files readable user groups, no need chmod. i've tried chmod 777 if you'd ask. 2. checked, secure-file-priv variable not set in mysql, no, load_file not restricted path.
any ideas might problem here?
i found out has apparmor. disabled apparmor mysql , worked. people having same problem, please read here: http://www.cyberciti.biz/faq/ubuntu-linux-howto-disable-apparmor-commands/
Comments
Post a Comment