Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL problema. Can't locate file generated by select into outfile '/tmp/aa.txt'

I ran grant file on my user. I'm using absolute path. Mysql user have privileges to write at /tmp. I just can't locate the file. I ran updatedb and then locate aa.txt, with no result.

I'm running:

select 'aaaaaa' into outfile '/tmp/aa.txt';

Mysql responds: Query OK, 1 row affected (0.02 sec)

The second time I run the same command, it get's an error:

ERROR 1086 (HY000): File '/tmp/aauua.txt' already exists

I'm running mysql 5.5.31 on Fedora 18. Does anybody knows what could be wrong?

like image 330
Diogo Melo Avatar asked May 26 '13 04:05

Diogo Melo


1 Answers

When you use SELECT ... INTO OUTFILE the file is created on the server host.

If you are aware of that, the problem might be that mysqld is started with systemd and configured to use a private /tmp directory, in that case you'll find it inside /tmp/systemd-namespace-XXXXXX/

See http://fedoraproject.org/wiki/Features/ServicesPrivateTmp

And you are not finding it with locate, since updatedb doesn't store files located in /tmp.

like image 188
DiegoG Avatar answered Oct 24 '22 18:10

DiegoG