Fast and easy MySQL backup and recovery with shell command

Quick backup and restore of the MySQL database using mysqldump and gzip utility:

Backup:

mysqldump -u <user> -p<password> <database_name> | gzip -9 > database_dump.sql.gz

Recovery:

gunzip < database_dump.sql.gz | mysql -u <user> -p<password> <database_name>

May 29, 2018