• Log in or Create an account

This article shows you how to rollback the backup you had taken previously. If you want to learn how to take a backup of your Magento 2 store, please read our previous article Magento 2 - Take backup.

As you all know by now, taking a backup is one of the most important steps in avoiding unexpected accidents. But, just taking a backup isn't sufficient. The backup needs to be saved correctly so that it can be used when needed and a backup is of no use if you don't know how to rollback.

Just like taking a backup, following are the 3 ways you can rollback your Magento 2 backup:

  • Using Command-Line Interface (CLI)
  • Using the Magento 2 admin
  • Manual backup of files and database on the server

Note: You cannot use internal rollback options (CLI and admin interface options) when you backed up the store manually.

Rollback using Command-Line Interface (CLI):

Following is the general command for rolling back a previous backup:

php bin/magento setup:rollback [-c|--code-file="<name>"] [-m|--media-file="<name>"] [-d|--db-file="<name>"]

Example usage:

php bin/magento setup:rollback -m 1521440082_db_DbBackup.sql

If you are unsure of the name of the backup you want to restore, you can run the following command to list all the available backups:

php bin/magento info:backups:list

Rollback using admin panel:

To rollback from the admin panel, go to System > Tools > Backups.

  • Click on the rollback link on the grid row that shows the backup you want to restore
  • Click OK if you would like to proceed with the rollback. Click Cancel to close the window.
  • Enter your password and click on the checkbox to put your store in maintenance mode.
  • Click OK to proceed with the rollback.


Note: The backups taken using internal Magento backup options can be rolled back using any of the internal Magento 2 rollback options. However, manual backups cannot be rolled back using the internal Magento 2 rollback options.

Manual Rollback:

Filesystem rollback: To rollback a manually backed up filesystem, upload and extract the contents of the filesystem into the Magento 2 root directory.

Database backup:  To rollback the database, you can either use a tool like phpMyAdmin or using CLI. Just empty the current database and import the exported database file.

Copyright © Hungersoft 2019

· Terms & Conditions · Privacy policy