DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Thomas has posted 33 posts at DZone. View Full User Profile

Backup And Restore A MySQL Database (with Compression)

12.10.2010
| 2753 views |
  • submit to reddit
        Backup & compress
mysqldump --default-character-set=utf8 --compress -u <user> -p <database_name> | gzip > <database_name>.sql.gz
Restore
zcat <database_name>.sql.gz | mysql --default-character-set=utf8 --compress -u <user> <database_name>