Skip to content

Instantly share code, notes, and snippets.

@manhdaovan
Last active March 12, 2018 01:20
Show Gist options
  • Select an option

  • Save manhdaovan/ad6631dc4e4506168dd67a9160ab37fc to your computer and use it in GitHub Desktop.

Select an option

Save manhdaovan/ad6631dc4e4506168dd67a9160ab37fc to your computer and use it in GitHub Desktop.
Init RAM disk and run MySQL on it. (MacOS)
#!/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
@manhdaovan
Copy link
Copy Markdown
Author

run: ./init_db_to_ram_disk.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment