简体   繁体   English

无法在mysql目录中加载数据文件

[英]can't load_file data in the mysql directory

I'm running as mysql root user on my system. 我在系统上以mysql root用户身份运行。

I can select load_file('/etc/passwd'); 我可以选择load_file('/ etc / passwd'); no problem 没问题

But when I try to select load_file('/var/lib/mysql/mysql'); 但是当我尝试选择load_file('/ var / lib / mysql / mysql'); I get NULL as a result why? 结果为何我得到NULL? this file is good, I can cat it as root and view the mysql user data, why cant mysql load_file it? 这个文件很好,我可以将其作为根目录并查看mysql用户数据,为什么mysql load_file无法呢? 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? 默认情况下,它的所有者是mysql用户,并且具有读取权限,因此mysql为什么不喜欢load_file? Is mysql somehow blocking access to this file and if so how can I bypass that? mysql是否以某种方式阻止了对该文件的访问,如果是,我该如何绕过它? Doing stuff like mysql/../mysql in the path doesn't work, and using hex encoding didn't work either? 在路径中执行mysql/../mysql之类的操作不起作用,并且使用十六进制编码也不起作用吗?

In order for load file to work make sure that all permissions are granted for the MySQL owner and group. 为了使加载文件正常工作,请确保已为MySQL所有者和组授予所有权限。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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