Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

How to setup mysql on tmpfs ?

I am reading a tutorial in french, where the author do it this way :

1.) Create a tmpfs directory :

mkdir /var/tmpfs
mount -t tmpfs -o size=1G tmpfs /var/tmpfs
chown -R mysql:mysql /var/tmpfs/mysql

2.) Add it to fstab :

tmpfs  /var/tmpfs  tmpfs  nodev,nosuid,noexec,noatime,size=1G  0 0

3.) Copy MySQL to tmpfs (is ramfs here is correct?)

service mysql stop
cp -Rfv /var/lib/mysql /var/ramfs/
chown -R mysql:mysql /var/tmpfs/mysql

4.) Edit /etc/my.cnf

datadir /var/tmpfs/mysql

Then restart mysqld and you can optionally add a startup/stop script to backup the ram data to disk...

But I am not sure the above is right : did the writer of this tutorial mistake ramfs for tmpfs here ? He then goes on to use ramfs in the start/stop script, but what ramfs has to do there, isn't it really tmpfs only ?

share|improve this question
    
Why would you do this? –  Aaron Brown Jul 11 '12 at 14:24
2  
To speed up Drupal's SimpleTests, it's really necessary. –  B2F Jul 11 '12 at 17:49

2 Answers 2

Seems like it was really

cp -Rfv /var/lib/mysql /var/tmpfs/

Working great now.

share|improve this answer

Before you try doing this: take a look at mysql's "memory" storage engine. I would stick with that rather than having to deal with the many edge cases with e tmpfs.

http://dev.mysql.com/doc/refman/5.5/en/memory-storage-engine.html

we were considering the exact same scenario, but luckly ran across the memory engine, and have not had a problem since.

share|improve this answer

Your Answer

 
discard

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.