Skip to content

Instantly share code, notes, and snippets.

@otkrsk
Last active August 29, 2015 14:05
Show Gist options
  • Save otkrsk/9189f652e6c53670fbcf to your computer and use it in GitHub Desktop.
Save otkrsk/9189f652e6c53670fbcf to your computer and use it in GitHub Desktop.
Backup and Restore MySQL Dump
#backup all databases in one file (eventually add the option --add-locks):
mysqldump -u [username] -p[root_password] [database_name] > file.sql
#backup all databases in one gzipped file:
mysqldump -u [username] -p[password] -–all-databases | gzip > file.sql.gz
#restore all databases:
mysql -u [username] -p[password] < file.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment