Mysql – thesql: Shall I change the thesql tmpdir from /tmp to /var/lib/thesql/tmp

MySQLtmp

Recently on one of the prodcution servers we have seen the replication being stopped due to the space issues on the /tmp drive which is having less space allocated.

I would like to move the tmpdir from /tmp[default] to /var/lib/mysql/tmp

Below are what I guess I should do.

  1. stop mysql
  2. create directory called tmp in the location /var/lib/mysql/
  3. add tmpdir = /var/lib/mysql/tmp/
  4. start mysql

Is there anything to be taken care of for the permission level of /var/lib/mysql/tmp/ ?

Best Answer

Below are what I guess I should do.

 1. stop mysql
 2. create directory called `tmp` in the location `/var/lib/mysql/`
 3. add `tmpdir = /var/lib/mysql/tmp/`
 4. start mysql

You can combine 1. to 4. by restarting MySQL after changing.

About 2., you should put the tmpdir outside of the datadir.

Is there anything to be taken care of for the permission level of /var/lib/mysql/tmp/?

chown mysql:mysql /path/to/tmp/dir is enough.