Is there a way to change the tmpdir on a MySQL server without restarting it? The issue is that I use a tmpfs mounted at /var/lib/mysqltmp but sometimes it's overflowing and causes issues. I don't want to restart the server, because that means around 2-3 hours of service degradation.

Another possible exit from this situation is to unmount the tmpfs, but trying it causes this error:

 [root@db2 /]# umount /var/lib/mysqltmp/
 umount: /var/lib/mysqltmp: device is busy.
    (In some cases useful info about processes that use
     the device is found by lsof(8) or fuser(1))

2 Answers 2


Seems like there is no easy and unobtrusive way to do it. However there is a way to increase the size of the tmpfs.

  1. Change the size in /etc/fstab accordingly
  2. Issue a mount -o remount and it will be resized without a need to release file handle locks.

tmpdir isn't a dynamic variable so "officialy" you can't, maybe you can play with symlinks but I would highly inadvisable to do this with a running MySQL.


  • Any ideas if I can unmount the tmpfs and continue running on disk? Is there a way to force mysql to release the tmpdir (even for a secnond)? The tmpdir seems empty, but cannot be unmounted.
    – Jacket
    Commented Jun 18, 2013 at 11:03
  • You could probably do something like what's described in this question: stackoverflow.com/questions/5987820/… ... but closing filehandles unexpectedly on a database server is likely to cause a crash, and possibly corruption or worse. MySQL is going to throw all sorts of errors if it can't access the tmpdir anymore. It might be possible to expand the tmpfs online, though. Commented Jun 18, 2013 at 11:18
  • It worked by changing the size in /etc/fstab and then issuing mount /var/lib/mysqltmp -o remount
    – Jacket
    Commented Jun 18, 2013 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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