Backing-up, restoring or migrating a WordPress website from one server to another was never been easier. Newbies ought to think these processes are as simple as one-click button. But, if you’re moving on to a new server or changing the host, you might have to go through a complex process of compressing, downloading and uploading all the stuff, including your FTP files and databases, and then fixing any coding issues that might result into post-restore errors.
Step # 1: Backup the Website
Backing up is the process of creating an identical copy of the files stored on your File Transfer Protocol (FTP) account and the MySQL database in the case of website migration to a different host or server, or to prevent data loss in case of website hack or technical issues.
A. Backup the Files
1. Open the cPanel.
2. Click on File Manager under the Files section.
3. Expand the following:
- /home/public_html
4. Click Select All in the right-side panel.
5. Right-click the selection, choose Compress.
6. Select the Zip Archive as your compression format.
7. Click Compress Files.
8. After successfully compressing the files, right-click the compressed file, and choose Download.
B. Backup the Database
1. Log-in to your cPanel.
2. Click Backup Wizard.
3. Click Backup.
4. Click MySQL Databases under the Select Partial Backup section.
5. Click the Database name displayed in the list corresponding to your website.
6. The download will start automatically.
Step # 2: Delete Duplicates
Scanning for dupes can help lower the bandwidth and save your server space, time and efforts. Do NOT attempt to permanently delete any files associated with your website. Only delete duplicate separately uploaded documents, music, videos, and images not as part of your regular website files.
1. Download a Dupes Finder for your FTP files.
Click here to download Clone Files Checker.
2. Click Add, select the downloaded files and then click on Start Search.
3. After finishing up, you’ll be asked to perform Quick-Fix or Review & Fix. The former deletes duplicates automatically, while the latter lists them out into a window so that you can take individual actions on your files.
Step # 3: Restore the Website
Website restoration is the process of uploading the data from secondary storage device (such as a local hard disk) to your server. It also involves deleting the database, user associated with the website, and then re-creating the same again. You’ll also need to assign necessary privileges to the user.
A. Delete Database & MySQL User
1. Open the cPanel.
2. Click on MySQL Databases.
3. Under Current Databases section, delete the database associated with your website.
4. Scroll down to the page bottom. Delete the user associated with your website.
B. Create a New User
1. Open the cPanel.
2. Click on the MySQL Databases.
3. Under MySQL Add New User section, specify a User Name and Password. In the case of shared hosting, you may receive an error when the user name is already in use by other websites stored on the shared hosting server.
4. Click Create User.
5. Note down the User Name, Password and Database Name.
C. Link the User to your Database
1. Under cPanel > MySQL Databases, scroll down to the Add User to Database section.
2. Select the newly created User and the corresponding Database you want to link to.
3. Click Add.
4. Check-up the box All Privileges and then click on Make Changes.
D. Perform Restoration
a. Restore the Files
1. Open the cPanel.
2. Click the File Manager.
3. Select Web Root, and then click Go.
4. Expand the following:
- /home/public_html
5. Click on Upload on the standard toolbar.
6. Click Choose File.
7. Select the compressed website backup file on your local machine to automatically upload it.
8. After successfully uploading the compressed backup file, extract the file contents.
b. Restore the Database
1. Open the cPanel.
2. Click Backup Wizard.
3. Click on Restore.
4. Click MySQL Databases.
5. Click Choose File.
6. Locate the Database file stored on your local machine.
7. Click Upload.
Step # 4: Finalising Set-Up & Troubleshooting Post-Restore Errors
At times, you may encounter different problems. An error may occur saying Error establishing a database connection as soon as you open the website. You may want to check-up the parameters set into the wp-config.php file. Update the host settings such as cPanel user name, server IP address, new domain name into the WordPress configurations file.
WordPress may also fail to upload new images into your posts. This issue can be easily tackled by clearing-up the upload_path text box into your corresponding database.
A. Modify the WP-Config.php File Contents
1. Open the cPanel.
2. Click on File Manager.
3. Open the following:
- /home/public_html
4. Right-click the wp-config.php file, select Edit.
5. Click on Edit.
6. Scroll down to the following code:
define(‘DB_NAME’, ‘Database_Name_Here‘);
/** MySQL database username */
define(‘DB_USER’, ‘DatabaseUserName‘);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘DatabasePassword‘);
/** MySQL hostname */
define(‘DB_HOST’, ‘localhost‘);
/** Database Charset to use in creating database tables. */
define(‘DB_CHARSET’, ‘utf8‘);
7. Enter appropriate Database Name, corresponding User Name and Password you noted down earlier while creating a new user in MySQL Databases.
8. Make sure that the DB_HOST and DB_CHARSET are set to localhost and utf8 respectively.
9. Click Save Changes.
B. Modify Code Related to Third Party Plugins
- Open the cPanel > File Manager.
- Open the wp-config.php file.
- Make sure that the cPanel user name, server IP Address, new domain name are properly updated. (The actual server IP Address can be found on the top of the left panel in the cPanel.)
- Click Save Changes.
C. Clear Default Upload Directory into the Database
1. In the cPanel, go to phpMyAdmin under Databases section.
2. Select the database displayed on your left panel.
3. Expand the wp_options node.
4. Move on to the second page on the right side.
5. Select Edit near the upload_path.
6. Clear the text box contents and then click Go.