Skip to content

Instantly share code, notes, and snippets.

@mikedamoiseau
Last active August 29, 2015 14:01
Show Gist options
  • Save mikedamoiseau/73b601b150b4820518fc to your computer and use it in GitHub Desktop.
Save mikedamoiseau/73b601b150b4820518fc to your computer and use it in GitHub Desktop.
Mysql database import/export with command line
# Export the database to a file
mysqldump -u YourUser -p 'UserPassword' YourDatabaseName | gzip > wantedsqlfile.sql.gz
# Make a local copy the file from the server
scp user@xxx.xxx.xxx.xxx:/path_to_your_dump/filename.sql.gz your_detination_path/
# Import the database locally
gunzip filename.sql.gz | mysql -u [user] -p [password] [database]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment