Skip to content

Instantly share code, notes, and snippets.

@luizventurote
Last active February 16, 2018 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luizventurote/ff589aaf2c21ab04bfd6dd834ca8762e to your computer and use it in GitHub Desktop.
Save luizventurote/ff589aaf2c21ab04bfd6dd834ca8762e to your computer and use it in GitHub Desktop.
Backup MySql database

Using n9m-Magerun for Magento

When you guys create a local dev environment, run this command to create database backup:

n98-magerun db:dump --strip='@development' --stdout | gzip > site-type-$(date +%Y%m%d%H%M%S).sql.gz

Replace “site" with the name of the site that you are backing up and “type" with either “prod”, “dev”, or “stage”.

MySql Dump

mysqldump database_name > database.sql
tar -czvf database.tar.gz database.sql

Compress Media folder

tar -czvf media.tar.gz current/pub/media/* --exclude "current/pub/media/import" --exclude "current/pub/media/catalog/product/cache" 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment