Last Updated: February 25, 2016
·
390
· colinodell

Exporting/Importing Compressed MySQL Backups

To export the database:

mysqldump -u {username} -p {database} | gzip > backup.sql.gz

To import the previously-create backup:

gunzip < backup.sql.gz | mysql -u {username} -p {database}

(Note: Both commands will prompt you for the database password.)