Menu

How to Backup PrestaShop Before Upgrading

Important Note

It is crucial to ensure the safety of your backups by storing them securely. Avoid leaving backups in publicly accessible locations, such as the root of your store.

Before making any changes to your PrestaShop store, especially upgrading your website, performing a comprehensive backup of all your data is strongly recommended. This includes both your files and your database. This documentation provides guidance to assist with the upgrade process.

 

File Backup

1. Copy Files

Start by backing up the files on your web server where PrestaShop is installed. These files include your PrestaShop folder containing the source code, modules, themes, images, and other essential resources.

  • Connect to your server using FTP, SSH, or RDP (depending on your hosting provider).
  • Copy the entire PrestaShop folder to another location on your server or download it to your local computer for additional security.

If you are backing up using the hosting cPanel, check if the cPanel has a backup tool. If it does, you can follow the backup steps in the example below:

Step 1: Log in to your hosting and select “Backup”.

Step 2:

  • Option 1: Partial backup

The “Partial backup” section allows for individual backups, which include options for Full source code, Database data, and Emails.

When you click on “Home Directory” a full backup of the source code at the current time will be automatically created on the hosting and downloaded to your computer via the browser. When you need to restore, select “Upload” under the “Restore a Home Directory Backup” section.

When you click on any of the database listings under the “Download a MySQL Database Backup” section, the current database will be automatically downloaded to your computer.

  • Option 2: Create a full backup at the current time

In the "Full backup" section, select "Download a full account backup". Next, choose “Generate backup” and wait (depending on the size of the source code, you will receive an email notification once the backup is complete).

After the backup is created, go to the “File Manager”. The backup you just created will be stored in “/Home/User” with a “tar.gz” file format. When you need to restore, extract this file.

 

2. Bonus Tip - Compress Files

Consider compressing all your PrestaShop files into a single archive file for faster backup downloads. Here's how to do it:

  • On Windows servers, use remote desktop access to navigate to your www folder and compress its contents into a ZIP file using Windows Explorer.
  • On Linux servers, access your server terminal via SSH and create a TAR file with the following command: tar -czf backup.tar.gz /var/www/html

 

Database Backup

1. Using MySQL Client (Command Line)

Use mysqldump to create a full backup of your PrestaShop database. Follow these steps:

  • Open a terminal window (Command Prompt on Windows or Terminal on Linux).
  • Execute the command to dump your database structure and data into an SQL file:

mysqldump -u username -p dbname > dump.sql

  • Replace username with your MySQL username, dbname with your PrestaShop database name, and enter your MySQL password when prompted.
  • For advanced users, include additional parameters for secure and efficient backup:

mysqldump --host=<IP_or_hostname> --user=<user> --password --single-transaction --create-options --extended-insert --complete-insert yourdbname > dump.sql

 

2. Using PHPMyAdmin (Web Interface)

PHPMyAdmin provides another method to export your PrestaShop database:

  • Log in to PHPMyAdmin, select your PrestaShop database, and go to the "Export" tab.
  • Choose the "Custom" method for more options and ensure all tables, views, etc., are selected.
  • Select options like "Use LOCK TABLES statement" and "Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER statement" for a comprehensive backup.
  • Click on "Go" to generate and download the SQL file.

 

3. Other MySQL Clients

Various MySQL clients such as MySQL Workbench, Navicat MySQL, Adminer, and Sequel Pro also offer export options for creating database backups. Refer to their respective documentation for detailed instructions:

 

NOTE: Make sure your system has enough available memory before starting the backup process.

 

By following these steps, you can safeguard your PrestaShop store data before proceeding with any upgrades or modifications. Regularly backing up your files and database ensures that you can restore your store to its previous state if any issues arise during the upgrade process. Always store backups in secure locations to prevent unauthorized access and data loss. Happy upgrading!

Nombre de vues: 111 vues