This method copies binary data files in the MySQL data directory rather than using the mysqldump
tool provided.
For a 55GB database:
- export ~2 minutes
- import ~3 minutes
./export.rb -d 'my_database' -u 'user' -p 'password' -o '/tmp'
./export.rb -h # for detailed information and defaults
./import.rb -d 'my_database' -u 'user' -p 'password' -s '/tmp'
./import.rb -h # for detailed information and defaults
- Script needs to be run on the server with MySQL client installed.
- This method locks each table individually during the export process.
- Script needs access to the MySQL
datadir
directory. - Only works with MySQL
- Copying databases for developers
- Creating test databases that are expendable
- Dumping staging data
- Do not use in production as it locks each table ~ 1-10 seconds depending on size
- Create gem
- Create Homebrew recipe
- Slackbot integration