MySQL tmpdir Parameter Modification
Today, I suddenly received an alert message saying that/the disk space usage exceeds the threshold. It was found that there were many abnormal SQL statements that could not be executed, resulting in continuous processing, resulting in temporary use of/tmp disk space.
Because the/tmp space of the operating system is limited, You need to modify the parameter and modify the value path of tmpdir.
Mysql> show variables like 'tmpdir ';
+ --------------- + ------- +
| Variable_name | Value |
+ --------------- + ------- +
| Tmpdir |/tmp |
+ --------------- + ------- +
1 row in set (0.00 sec)
Mysql> set global tmpdir = '/Data/app/mysql5.6.25/mysqltmp ';
ERROR 1238 (HY000): Variable 'tmpdir' is a read only variable
You can only modify the configuration file.
Restart mysql
Mysql> show variables like 'tmpdir ';
+ --------------- + -------------------------------- +
| Variable_name | Value |
+ --------------- + -------------------------------- +
| Tmpdir |/mysql5.6/var/tmp |
+ --------------- + -------------------------------- +
1 row in set (0.00 sec)
Q: but the service cannot be restarted in the production environment. How can this problem be solved?
This article permanently updates the link address: