How to Create Backups for Your Magento 2 Store?
- Nidhi Arora
- 4 years
- 340 views
Even though Magento 2 is considered the most secure platform, there are always unexpected moments when your Magento 2 store could break. For instance, a server crash, exploits, hacking, bugs, and other mistakes can happen at any time. Thus, it’s beneficial to have the backups of your Magento 2 store so that you can recover your store quickly whenever you need.
Note: Restoring a backup of your M2 store will only recover the data that was last saved by you. If you are in any complex situation or in need of the help of the best Magento developers, you can contact them right here.
There are two methods to create a backup for your Magento 2 store. The first one is to create a backup via the admin panel, and the second one is to run a backup through the command line of your server.
In this “How To” blog, we will explain to you both of these methods and the steps to create backups for your M2 store. So, let’s get started.
Magento 2 Backup Via the Admin Panel
Step 1: Log in to your M2 admin panel
Step 2: Now navigate to this path System > Tools > Backups
Step 3: Here on this page you will find backup options.
The System Backup will be all of your files and the code itself. The Database Backup will be your database tables consisting of items, such as order, customer details, and admin configurations. And, the Media Backup is going to be all of your media folders, plus the largest backup because it covers your images and videos.
After the Backup selection, you will see a page where you should name the backup file. We recommend you use the data and the type of backup while naming the backup file (only for easy reference). Make sure you’re placing your store into maintenance mode during the backup process. It will help you to limit the amount of data that is altering during this backup process.
You can go for the final option if you prefer to isolate the media folder from the backup. As you know, it is the largest set of files, and for many Magento 2 stores, these elements are not going to alter as commonly as other sections of the store.
After creating the file, you can tap the filename to download the backup. Moreover, you can also restore your store back to your previous version of the store. By using this powerful tool, you can eliminate any of the new data on your Magento 2 store that was excluded from that backup process. You only need to ensure about the data you will be eliminated by restoring to any of your backup files.
Magento 2 Backup Via the Command Line
To execute the Magento 2 DB backup via the command line, you first need to switch to the Magento file system owner. Now, just initiate the following command:
1. setup:backup [–code] [–media] [–db]
This command will easily switch your Magento store to the maintenance mode following the media, database, system file backups, and will also end it after switching the maintenance mode off. That’s all you need to do to backup Magento 2 DB via the command line.
That’s all you need to do for creating backups for your Magento 2 store. Hopefully, now you may have no issue while performing these methods. In case you face any difficulty, you can contact us at [email protected] to get a helping hand from our certified Magento developers.