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 ?