Created
August 20, 2012 12:26
-
-
Save cgallemore/3403675 to your computer and use it in GitHub Desktop.
Script to setup MySQL on ramdisk after restart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This is a script I use to setup MySQL on ramdisk | |
# after I need to reboot. This assumes that you already | |
# have MySQL installed and have previously moved your | |
# MySQL files to a backup location, e.g.: | |
# mv /var/lib/mysql /home/cgallemore/workspace/mysql | |
stop mysql | |
mkdir /tmp/ramdisk | |
mount -t tmpfs -o size=256M tmpfs /tmp/ramdisk/ | |
unlink /var/lib/mysql | |
cp -pRL /home/cgallemore/workspace/mysql /tmp/ramdisk/mysql | |
ln -s /tmp/ramdisk/mysql/ /var/lib/mysql | |
chmod -R 700 /var/lib/mysql | |
chown -R mysql:mysql /var/lib/mysql | |
start mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment