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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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))
share|improve this question
up vote 2 down vote accepted

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.
share|improve this answer

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.


share|improve this answer
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 Jun 18 '13 at 11:03
You could probably do something like what's described in this question:… ... 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. – James Lupolt Jun 18 '13 at 11:18
It worked by changing the size in /etc/fstab and then issuing mount /var/lib/mysqltmp -o remount – Jacket Jun 18 '13 at 11:41

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.