WordPress – Backup & Restore

In this chapter, we will learn how to back up and restore files and databases in WordPress. The backup and restore process in WordPress consists of two main parts:

  • WordPress Files Backup
  • WordPress Database Backup
  • WordPress Files Restore
  • WordPress Database Restore

WordPress Files Backup

To back up WordPress files, you need to install the FileZilla Client on your system.

Follow the steps below to perform a file backup operation in WordPress:

Step (1) − Open the FileZilla Client, as shown in the screenshot below.

Step (2) − Enter the Host, Username, Password, and Port details, the same credentials you use to log in to your cPanel account.

After entering all the required details, click on the “Quickconnect” button.

Step (3) − Once connected, you will see all the files and folders of your WordPress site displayed on the right-hand side, as shown on the screen.

Step (4) − Select all the files and folders, then right-click and choose the “Download” option to save them to your system.

After downloading the WordPress files, they will be saved on your local system.

WordPress Database Backup

Follow the steps below to back up your WordPress database:

Step (1) − Open your web browser and enter the following path http://localhost/phpmyadmin This will open the phpMyAdmin interface, as shown on the screen.

Step (2) − Click on the database named “wordpress” that you created for your WordPress installation.

Step (3) − After selecting the “WordPress” database, the corresponding page will open. Click on the “Export” tab.

Step (4) − You will see two export options: Quick and Custom. Select your preferred method and click on the “Go” button to proceed.

After exporting, the database file will be saved on your system.

Restoring WordPress Files

Follow the steps below to restore WordPress files using FTP:

Step (1) − Open the FileZilla Client and log in to your website using FTP credentials, as shown on the screen.

Step (2) − Open the local directory in the FTP client, then upload all the WordPress files to your website server, as shown on the screen.

Step (3) − Navigate to your WordPress folder and locate the wp-config.php file. Before making any changes, make a copy of this file and rename it as a backup. This ensures you can restore it if any mistake occurs.

Open the wp-config.php file and update the following lines:

define(‘DB_NAME’, ‘db_name’);

Replace 'db_name' with the name of your database.

define(‘DB_USER’, ‘db_user’);

Replace 'db_user' with your MySQL username.

define(‘DB_PASSWORD’, ‘db_password’);

Replace 'db_password' with your MySQL password.

Save the changes and upload the updated wp-config.php file to your WordPress site via FTP.

Restoring WordPress Database

Follow the steps below to restore your WordPress database:

Step (1) − Open your web browser and type http://localhost/phpmyadminThe phpMyAdmin interface will appear, as shown on the screen.

You can either create a new database or import your backup into an existing database.

In this example, we will create a new database named new_wordpress and click on the “Create” button.

Step (2) − After creating the database, you will see it listed in phpMyAdmin. Click on the database name new_wordpress to open it, as shown on the screen.

Step (3) − Click on the “Import” tab to begin importing your database backup.

Step (4) − Click on the “Choose File” button to select the database backup file (SQL) from your system. After selecting the file, ensure the Format is set to SQL, as shown on the screen.

Step (5) − After clicking the Go button, you will see a confirmation message indicating that the SQL file has been uploaded successfully.

Start WordPress Hosting today.