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

StackOverflow https://stackoverflow.com/questions/16756339

  •  30-05-2022
  •  | 
  •  

سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top