MageHost DB backup script
If you are running Magento and you want to backup the database currently in use, you can execute inside a SSH shell:
~/bin/backup_mysql.php
The script will:
- Read the database login details from your Magento config
- Create a backup in ~/backup
- Show you the name and size of the created backup
DB backup using N98-magerun
Magento 1.x
If you want to create a backup of you Magento 1.x database you can use n98-magerun, for example a development backup without customer data:
n98-magerun db:dump -c gzip --strip=@development ~/backup/db_dev.sql.gz
Magento 2.x
If you want to create a backup of you Magento 2.x database you can use n98-magerun2, for example a development backup without customer data:
n98-magerun2 db:dump -c gzip --strip=@development ~/backup/db_dev.sql.gz
See also: Restore a database backup Manage the MySQL database Create a backup of the files