Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Can't create temporary files on /var/tmp.

mysqldump: Error: 'Can't create/write to file '/var/tmp/mysql.k6NKGk/#sql_5dc_2.MAI' (Errcode: 2)' when trying to dump tablespaces

On my OS.

 id mysql
uid=60(mysql) gid=105(mysql) groups=105(mysql)

ls -l /var/
drwxrwxrwt  2 root root  72 oct 24 16:43 tmp

What can I do?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Perhaps you can change the owner with

chown -R mysql:mysql /var/tmp

Check to see if there is a [mysqldump] header in /etc/my.cnf. It may look like this:


or perhaps under the [mysqld] header


Try commenting it out and trying mysqldump again.

share|improve this answer
the ownership is not a good practice, but commenting out the tmp and chanchind de tmpdir did work for me. –  maniat1k Oct 26 '12 at 12:19

Your Answer


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.