Skip to content

Instantly share code, notes, and snippets.

@a-ast
Created June 1, 2015 14:30
Show Gist options
  • Select an option

  • Save a-ast/f134a4c75736a1f6fe9c to your computer and use it in GitHub Desktop.

Select an option

Save a-ast/f134a4c75736a1f6fe9c to your computer and use it in GitHub Desktop.
MySQL clone database
# Created database to be cloned
mysql -u [user] -p -e "create database [destination_database] character set utf8;"
# Backup database with compression
mysqldump -h localhost -u [user] -p --quick [source_database] | gzip > [backup_file]
# Uncompress and restore database
gunzip -c [backup_file] | mysql -u [user] -p [destination_database]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment