Difference of write authorization on file system with mySQL
2
votes
1
answer
189
views
On my local mySQL (on CentOS 6 VM) database I wanted to export some data from the DB to a file like this:
SELECT html
FROM mytable
WHERE lang = 'en' and id='KEY01'
INTO OUTFILE 'key01_en.html'
By doing this, the file will be saved in the /var/lib/mysql/mydbschema/ by default.
Now, I want the file to be saved in my user let say /home/userone/dump_html folder
If I say this (I launch the
mysql
command from the shell, and logged as "userone":
SELECT html
FROM mytable
WHERE lang = 'en' and id='KEY01'
INTO OUTFILE '/home/userone/dumphtml/key01_en.html'
It makes an error that the process does not have enough rights to write there.
But now still from the mysql> prompt, if I make:
SELECT html
FROM mytable
WHERE lang = 'en' and id='KEY01'
INTO OUTFILE '/tmp/key01_en.html'
;
-- and then
system mv /tmp/key01_en.html /home/userone/dumphtml/key01_en.html
;
It works without any issue.
It looks strange to me the SQL cannot write on my disk but the system
command can. Any idea why?
(The discussion started on this point from [this answer](https://stackoverflow.com/a/23390257/628006) on SO)
Asked by рüффп
(151 rep)
May 9, 2014, 06:29 AM
Last activity: Jun 22, 2025, 06:05 AM
Last activity: Jun 22, 2025, 06:05 AM