Last active
March 12, 2018 01:20
-
-
Save manhdaovan/ad6631dc4e4506168dd67a9160ab37fc to your computer and use it in GitHub Desktop.
Init RAM disk and run MySQL on it. (MacOS)
This file contains hidden or 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 | |
| # Create 2GB RAM disk | |
| diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://4194304` | |
| # Install mysql to above ramdisk, with no password | |
| mysqld --initialize-insecure --log-error-verbosity --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/Volumes/ramdisk/mysql --tmpdir=/tmp | |
| # Stop current mysql if existing | |
| mysql.server stop | |
| # Start mysql with new data dir on ramdisk | |
| mysql.server start --datadir=/Volumes/ramdisk/mysql |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run:
./init_db_to_ram_disk.sh