Home  >  Article  >  Database  >  Where is the default tmpdir of mysql?

Where is the default tmpdir of mysql?

anonymity
anonymityOriginal
2019-05-09 14:09:244601browse

Mysql data is stored in the data folder in the user-specified or default location. The default tmpdir is also stored in the data folder. MySQL temporary files are stored here and cannot be easily deleted.

Where is the default tmpdir of mysql?

Source of the error?

The upper directory /data where the MySQL data directory /data/mysql is located lacks disk space, causing MySQL to fail to start, so other useless directories in the /data directory except the mysql subdirectory are cleaned up. Restarting the discovery still failed. Check the error log.

See the following error:

/usr/local/mysql/bin/mysqld: Can't create/write to file '/data/tmp/ibbLmEoD' (Errcode: 13 - Permission denied)

It turns out that when cleaning up useless directories, the tmpdir-/data/tmp directory specified in the MySQL configuration file was accidentally deleted, causing some temporary files or tables when MySQL Server started to be unable to be written. , causing the startup to fail. After rebuilding the directory and granting the correct permissions, restart MySQL Server and start it normally.

Let’s talk about the MySQL temporary directory parameter:

Command line parameter format: --tmpdir=path

Configuration file parameter format:tmpdir=path

The temporary directory is used to store temporary files or temporary tables. The value can be a ":" (Unix) or ";" (Windows) separated list of paths that can be used in turn to spread the load to different disks. If the MySQL server is acting as a Slave, you cannot point this directory to a directory based on the memory file system or a directory that will be cleared when the host is restarted, because the Slave needs these files to copy the temporary table or perform the LOAD DATA INFILE operation. These files Loss will cause replication to fail. This means that the slave's tmpdir cannot be set to the default /tmp directory of the Linux system. For Slave, you can use another configuration item slave_load_tmpdir to set its temporary directory, so that Slave can not use the temporary directory set by the general option tmpdir. There is no such restriction for MySQL servers in non-Slave roles.

If the temporary directory does not exist or the permissions are incorrect, it will not only cause MySQL Server to fail to start, but also cause other MySQL utilities that may use the temporary directory to run abnormally. Many MySQL-related programs will read option values ​​from the MySQL Server configuration file, such as the full backup program xtrabackup. The following error is caused by the temporary directory specified in the MySQL Server configuration file not existing.

xtrabackup_56: Can't create/write to file '/data/tmp/ibHbumcM' (Errcode: 2 - No such file or directory)

2014-07-23 16:04: 42 7f1b25c607e0 InnoDB: Error: unable to create temporary file; errno: 2

xtrabackup: innodb_init(): Error occured.

innobackupex: Error:

innobackupex: ibbackup failed at /usr/bin/innobackupex line 389.

The above is the detailed content of Where is the default tmpdir of mysql?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn