MySQL Variables tmpdir 数据库 参数变量解释及正确配置使用

本站中文解释

tmpdir是MySQL数据库中用于存储临时文件的临时存储路径。其默认值取决于你所使用的平台,一般为/tmp,Linux系统则为/var/tmp。

修改tmpdir可以使MySQL使用指定的存储路径来访问临时文件,其可以保证这些文件有更稳定的访问性能,从而提升MySQL的性能。

要将tmpdir参数设置为指定的路径,只需要在my.cnf中添加tmpdir变量,将其设置为指定的路径,如:

tmpdir=/data/tmp

然后重启MySQL即可。

官方英文解释

tmpdir

Command-Line Format --tmpdir=dir_name
System Variable tmpdir
Scope Global
Dynamic No
Type Directory name

The path of the directory to use for creating temporary files.
It might be useful if your default /tmp
directory resides on a partition that is too small to hold
temporary tables. This variable can be set to a list of
several paths that are used in round-robin fashion. Paths
should be separated by colon characters (:)
on Unix and semicolon characters (;) on
Windows.

tmpdir can be a non-permanent
location, such as a directory on a memory-based file system or
a directory that is cleared when the server host restarts. If
the MySQL server is acting as a replica, and you are using a
non-permanent location for
tmpdir, consider setting a
different temporary directory for the replica using the
slave_load_tmpdir variable.
For a replica, the temporary files used to replicate
LOAD DATA statements are stored
in this directory, so with a permanent location they can
survive machine restarts, although replication can now
continue after a restart if the temporary files have been
removed.

For more information about the storage location of temporary
files, see Section B.3.3.5, “Where MySQL Stores Temporary Files”.


数据运维技术 » MySQL Variables tmpdir 数据库 参数变量解释及正确配置使用