10

I have installed Debian Lenny, PHPmyadmin and postfix.

When using PHPmyadmin GUI and access any table with data i get:

Can't create/write to file '/tmp/#sql_xxxx.MYI' (Errcode: 13)

doing perror 13 says:

OS error code  13:  Permission denied

I find the tmpdir lik so:

mysqladmin -p variables | grep -w tmpdir
| tmpdir                          | /tmp

Now that means that mysql cannot write to /tmp. Making the permissions to :777 fixes that. But I doesn't feel right I have to do that. Is there a better way/fix?

Should I change the value tmpdir in /etc/mysql/my.cnf?

1
  • thanks for including the mysqladmin output. I've now used this to donate a dedicated tmpdir for mysql, adding a little security. Jun 15, 2014 at 17:06

2 Answers 2

22

It looks like your permissions on /tmp are wrong. They really should be read/write/execute for everyone with the sticky bit set.

chmod 1777 /tmp

The sticky bit add some restrictions to how other users interact with files not created or owned by them, so there's no reason to worry.

If you wish, you may also create a seperate directory owned and writeable by the mysql user and specify that directory in my.cnf to be used instead of the system wide /tmp.

1
  • Thank you so much for this: "chmod 1777 /tmp" the sticky bit 1 was something i did not know and it killed me be cause I lost lots of time on this not knowing why. Now i do Thanks for posting this "chmod 1777 /tmp"
    – user63634
    Dec 14, 2010 at 20:47
3

Normaly the /tmp directory is writeable for everyone. You shouldn't be concerned about this. Additional the sticky bit is set so only root and the owner of a file can delete that file.

chmod 777 /tmp
chmod o+t /tmp

Have a nice day

2
  • does anyone know the octal number for the sticky bit?
    – grub
    Nov 15, 2009 at 11:35
  • Yep, it's 1 on the first octal.
    – Roy
    Nov 15, 2009 at 11:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .