How to Backup Magento 2

How to Backup Magento 2

If you are running an eCommerce store, you know the importance of the data that you own.

Creating backups is very important for any web application. It is because all the value of a web application is in the data.

The purpose of a backup is to recover the code and data to your store.

If the data is lost, your Magento store is lost. It is important to have a backup plan so that you never lose your store.

If you are using Magento, you can take backups with ease.

How to Take Magento Backup Via SSH

To take a backup of your site, you need to back up both your Magento files and the Magento database.

Here are the steps to back up your Magento files and database via SSH.

  1. Connect to your server via SSH using the command:

ssh username-ssh@serverIP

  1. Navigate to the root directory of Magento. For example:

cd /home/cloudpanel/htdocs/www.domain.com

  1. Take the Database dump using the command:

mysqldump -h'host' -u'username' -p'password' --opt --single-transaction --quick --routines database > /home/cloudpanel/htdocs/www.domain.com/restore-backup.sql

  1. Compress the backup file in .tar format.

tar -zcvf backup.tar.gz /home/cloudpanel/htdocs/www.domain.com

How to Take Magento Backup Via FTP

You can backup the Magento store to an external server via FTP.

Severs can get hacked or face downtime. In such a case having a backup on a remote server is better. Backups can get your store online and functional.

You can easily restore the site using a backup from an external source.

  1. Connect to your server using an FTP client. Such as FileZilla or WinSCP.

  2. Navigate to the root directory of Magento. For example:

/home/cloudpanel/htdocs/www.domain.com

  1. Download the root directory on your local system and compress it.

  2. Log in to your CloudPanel:

/home/cloudpanel/htdocs/www.domain.comgt-commerce.com/login/

  1. Navigate to Databases > Magento Database

  2. Open the database in PHPMyAdmin.

How to Take Magento Backup Via FTP

  1. Select the database and click on export.

How to Take Magento Backup Via FTP

  1. Choose the Quick exporting method, set SQL as a needed format. Click the Go button and download the database.

How to Take Magento Backup Via FTP

Conclusion

It is very important to create backups regularly. Every Magento store owner must have a system to back up the database regularly.

This helps avoid exploits, bugs, hacks, crashes, and any such data loss mistakes.

This tutorial will help execute the Magento 2 store backup. You can follow the steps mentioned above to backup media files, database, and full system.

For more tutorials on Magento, check out the MGT Commerce Tutorials.

Shraddha S.
Shraddha S.
Head of Content

With a master in Computer Science, Shraddha Singh has a lot of thoughts about Technology and the Cloud Services Industry. An Indian native and a professional Technical writer, she gets her management skills from IIT-B.


Get the fastest Magento Hosting! Get Started