MilesWeb Hosting Forum

Web Hosting Technical Support => How To's => Topic started by: Administrator on April 21, 2014, 05:16:12 PM

Title: How To Change MySQL Temporary Directory ?
Post by: Administrator on April 21, 2014, 05:16:12 PM
Hi Members,

By default the temporary directory for your MySQL server is set to /tmp folder. When you perform any queries, repair the tables, perform tasks on the database, etc; the temporary files are stored in this directory.

Just in case, if the /tmp partition is running out of space you can either delete these files OR create a new directory with large disk space. Assign this directory as temporary directory for MySQL server.

Open MySQL configuration file in your favorite editor

vi /etc/my.cnf

Add the line below & save the file.

tmpdir = /home/mysql-tempdir

Create the folder on your server and set ownership and permissions as below.

chown mysql.mysql  /home/mysql-tempdir
chmod 1777 /home/mysql-tempdir

Restart MySQL service & you have successfully changes the temporary directory.

Cross check it with the command below.

mysqladmin variables | grep tmpdir

Feel free to reply this thread if you face any other issues.