Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

Thanks

share|improve this question
    
thanks for including the mysqladmin output. I've now used this to donate a dedicated tmpdir for mysql, adding a little security. –  Florian Heigl Jun 15 at 17:06

2 Answers 2

up vote 12 down vote accepted

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.

share|improve this answer
    
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 '10 at 20:47

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

share|improve this answer
    
does anyone know the octal number for the sticky bit? –  grub Nov 15 '09 at 11:35
    
Yep, it's 1 on the first octal. –  Roy Nov 15 '09 at 11:47
    
thank you for the info :-) –  grub Nov 15 '09 at 12:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.