开发者

MySQL can't write to file, permission denied. (Error 13)

开发者 https://www.devze.com 2023-02-16 05:30 出处:网络
I have a web application that runs queries on the database. The application is trying to run a query, and send the results to the an output file. I have confirmed that the issue is actually开发者_JS百

I have a web application that runs queries on the database. The application is trying to run a query, and send the results to the an output file. I have confirmed that the issue is actually开发者_JS百科 a permission denied (error 13) problem, not an issue with any other part of the query. A simplified form of the query follows:

SELECT 'anything'
INTO OUTFILE '/var/www/html/sl/filestore/dbadpt_database.tmp'  
FROM INFORMATION_SCHEMA.TABLES;

This query runs fine when I remove the INTO OUTFILE line. I have tried every permissions setting for this dir that I can think of. I have even changed the permission to 777, and gotten the same results. (Yes, I know 777 is not secure. Just did it for testing) I have tried every ownership combination of 'root', 'apache', and 'mysql' that I could think to try for this dir. I have pasted the above query into the MySQL command-line tool, and it has produced the same results.

We are running CentOS 5.5. The web server running the application is Apache 2. I cannot create the file ahead of time, nor can I change the directory that the program is trying to write to.


I would hazard a guess that problem is with SELinux.

The first thing I would try would be setenforce 0 and see if that fixed it. It will only fix the symptoms (you still need to reconfigure SELinux to allow what you need), but it will at least confirm whether that's the problem or not.

0

精彩评论

暂无评论...
验证码 换一张
取 消