Created
December 3, 2013 20:17
-
-
Save gustavobgama/7776791 to your computer and use it in GitHub Desktop.
Commands to export/import/transport mysql database dumps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: http://webcheatsheet.com/sql/mysql_backup_restore.php | |
# import without compression | |
mysql --host=host --user=user --password=password database < path_to_file.sql | |
# import with compression | |
gunzip < path_to_file.sql.gz | mysql --host=host --user=user --password=password database | |
# export wihtout compression | |
mysqldump --host=host --user=user --password=password database table --where="condition" > path_to_file.sql | |
# export with compression | |
mysqldump --host=host --user=user --password=password database table --where="condition" | gzip -9 > path_to_file.sql.gz | |
# dump between servers | |
mysqldump --host=host --user=user --password=password database | ssh user@server "mysql --user=user --password=password database" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment