0

My question may really be, why can't MySQL write to /tmp. The server version is : Server version: 5.1.73 Source distribution

Here are the details: I have looked through some of the suggested posts that popped up when I wrote the title to this post. I have also looked at this post and Snow Crashe's answer. I've looked again at one of my own posts and then searched the MySQL documentation hoping to find an option like INTO LOCAL OUTFILE, but such an option appears not to exist.

When I issue the following sql query, I get an access denied error.

SELECT * 
INTO  OUTFILE '/tmp/feb_gic.txt'
FROM   gic_employees 
WHERE  bill_month='201502';

My user has all privileges to a MySQL database given through grant.

So, after reading all this, why can't MySQL write to /tmp? MySQL cannot write to /tmp even if my user is logged into mysql, let alone if mysql -e is used.

Community
  • 1
  • 1
octopusgrabbus
  • 10,555
  • 15
  • 68
  • 131
  • The server needs to have access to the directory. – Gordon Linoff Mar 05 '15 at 15:26
  • Does /tmp/feb_gic.txt exist? What does the ownership/permissions look like? Will it work if you `touch /tmp/feb_gic.txt && chmod 777 /tmp/feb_gic.txt` – andrunix Mar 05 '15 at 15:26
  • No, I'm writing it out for the first time, but I'll try your suggestion. I've never had trouble dumping stuff out to /tmp though. That's what it's for. – octopusgrabbus Mar 05 '15 at 15:29
  • @andrunix doing that won't work. I understand why MySQL can't write to my user's directory. MySQL doesn't have privileges to that, but it should have privileges to /tmp. – octopusgrabbus Mar 05 '15 at 15:31

0 Answers0