Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question tmpfs. I would like to use it for mysql tmp. My question is next:

If my server crash, data in /tmp are deleted (it's the tmpfs rule) so mysql cache tables are deleted.

So, if my server crash, data are saved or I loose all data don't put in the mysql basedir ?

Sorry if my question is weak ;)


share|improve this question
up vote 0 down vote accepted

Unless you design a mechanism to save the data to disk, any changes will be lost. A wrapper script in init would be a good starting point.

It's important to realize that it's difficult to use a mechanism like this and design it to be infallible. If the server suffered a total crash or complete loss of power, you would have data loss. You would have to design your backups to compensate for this and decide what level of risk you are comfortable with.

I would probably have a replication slave writing to disk as a means to have a copy of the data in case of failure.

Related questions:


I read too quickly, I thought you were talking about storing the database in tmpfs. pjz's answer covers storing MySQL temporary data on a tmpfs /tmp filesystem. It's okay unless you replicate.

share|improve this answer
Thanks for your answer. Mysql write many time in my disk so use tmpfs is a good solution to resolve this problem. I don't run with replication so data should be fine :) – Kiva Jun 25 '10 at 13:43
You're welcome, please see my edit. – Warner Jun 25 '10 at 13:48
I'd like to delete my answer but I can't because you accepted it. – Warner Jun 25 '10 at 14:13

According to the mysql docs, your data should be fine unless you're running a replication slave.

share|improve this answer

mysql tmpfs

I have very small mysql DB around 4GB above link is really help try out

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.