Skip to content

Instantly share code, notes, and snippets.

@mttjohnson
Created November 6, 2015 22:48
Show Gist options
  • Save mttjohnson/7a2d5fbc88d411b4dfd1 to your computer and use it in GitHub Desktop.
Save mttjohnson/7a2d5fbc88d411b4dfd1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# stop on errors
set -e
# turn on debugging
set -x
mysql -e "DROP DATABASE IF EXISTS \`test_import\`; CREATE DATABASE IF NOT EXISTS \`test_import\` DEFAULT CHARACTER SET utf8;"
START_TIME=$(date -u +"%s")
# 2 minutes
#vagrant ssh db -- 'mysql -uroot --password="" -D test_import --default-character-set=utf8 < /server/.shared/magento-database.sql'
#vagrant ssh db -- 'pv /server/.shared/magento-database.sql | mysql -uroot --password="" -D test_import --default-character-set=utf8'
# ? min
#vagrant ssh web -- 'mysql -D test_import --default-character-set=utf8 < /sites/m2esedev.dev/magento-database.sql'
# 27 minutes
#mysql -D test_import --default-character-set=utf8 < /sites/m2esedev.dev/magento-database.sql
#pv /sites/m2esedev.dev/magento-database.sql | mysql -D test_import --default-character-set=utf8
# 2 min
pv /sites/m2esedev.dev/magento-database.sql | ssh dev-db 'mysql -uroot --password="" -D test_import --default-character-set=utf8'
END_TIME=$(date -u +"%s")
TIME_DIFF=$(($END_TIME-$START_TIME))
echo "$(($TIME_DIFF / 60)) minutes and $(($TIME_DIFF % 60)) seconds elapsed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment