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

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

本文介绍了无法在mysql目录中加载数据文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在系统上以mysql root用户身份运行.

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

我可以选择load_file('/etc/passwd');没问题

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

但是当我尝试选择load_file('/var/lib/mysql/mysql');结果是NULL为什么?这个文件很好,我可以将其作为根目录并查看mysql用户数据,为什么mysql load_file无法呢?其权限是默认权限:

But when I try to select load_file('/var/lib/mysql/mysql'); I get NULL as a resultwhy? 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

默认情况下,它的所有者是mysql用户,并且具有读取权限,那么mysql为什么不喜欢load_file呢? mysql是否以某种方式阻止了对该文件的访问,如果是的话,我该如何绕过它呢?在路径中执行mysql/../mysql之类的操作不起作用,使用十六进制编码也不起作用吗?

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?

推荐答案

为使加载文件正常工作,请确保已为MySQL所有者和组授予所有权限.

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/*

这篇关于无法在mysql目录中加载数据文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 01:11