Move MySQL tmp directory

Rob —  July 16, 2014 — Leave a comment

You’ll eventually run into a client who has a crashed table in their database – this table will be pretty large – maybe even larger than the system’s default temporary directory (usually /tmp).

You could resize /tmp, but it is even easier to move the directory MySQL uses!

Here is a little script that will remove any tmpdir lines from your /etc/my.cnf file and will also add /home/mysql_tmp as its directory to use. You can name it whatever you want… but the reason I went with /home/something is because most of the hosting servers we set up will have large /home partitions. You don’t want to choose a directory that will end up filling up your / partition.

You could also increase the size of tmp, but that’s another tutorial.

Let’s see if it worked:

You should see something like:

Related posts from Linux Brigade!

No Comments

Be the first to start the conversation.

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url=""> 

*