HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to change "tmpdir" on a running MySQL instance

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
instancemysqlrunninghowchangetmpdir

Problem

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))

Solution

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

  • Change the size in /etc/fstab accordingly



  • Issue a mount -o remount and it will be resized without a need to release file handle locks.

Context

StackExchange Database Administrators Q#44744, answer score: 3

Revisions (0)

No revisions yet.