mysqldump failed to create backup with error “mysqldump: Error: Can’t create/write to file /tmp/”‏

System:

  • Debian 5 (Lenny)
  • MySQL 5.1.51
  • login as root

Problem:
mysqldump failed to create database backup even I’m logging-in as root. Error example:

It looks like mysqldump trying to write to /tmp even if  I’m tell it to save to my home (/root).
Apparently this problem also happen inside mysql console when running ‘describe’ command, example output inside mysql console:

Cause:
Apparently, mysqldump and ‘describe’ command need to write temporary file to /tmp
all mysql commands is ran by mysql server user, not as user currently logging-in (even root), so, mysql server user (in Debian: mysql) need to have permission to write to /tmp

Solution:

Try it! (No need to restart mysql)

Leave a Reply

%d bloggers like this: