Skip to content

Instantly share code, notes, and snippets.

@Kein1945
Created December 3, 2016 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Kein1945/1b255a1b7001670ea8fc9ad265a410c3 to your computer and use it in GitHub Desktop.
Save Kein1945/1b255a1b7001670ea8fc9ad265a410c3 to your computer and use it in GitHub Desktop.
Allow copy remote database to local mysql database throw ssh
#!/usr/bin/bash
mysql -u user -e 'DROP DATABASE IF EXISTS db_dev; CREATE DATABASE db_dev;'
ssh hlts -C -o CompressionLevel=9 'mysqldump -udeploy --password=password \
--skip-lock-tables \
crm | gzip -9 -c' | gunzip | mysql -u root db_dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment