Online economic activity is undertaken to earn a profit and to maintain its continuity, full backups, and timely restoration as needed are crucial. Also, when, there is need to change the hosting company, or change of website from one server to another, backups are important.
If you are using cPanel , first you need to backup your site and then restore it to the destination server. Therefore, the entire process can be broken down into two steps. Let’s discuss each of them separately:
Select Backup starting from the first page
Choose “Full Backup” from the second page
Select a destination folder where you want to backup your files.
- You can save the files to three different destinations:
- You can store the files to the root directory of your server
- You can save the files to a remote machine using FTP or SCP
- You can download the files to your local computer
Enter an email address in the mentioned field. Once the backup process completed, notified through an email.
Click on “ Generate Backup ” button.
If you wish to download the backup files to your computer, you can do so by clicking the filename under “Backups Available for Download”.
The files backed-up contain the date of backup in MM-DD-YYYY format. The files converted into a compressed folder with .tar.gz format. You can access these files through SSH or file manager.
Restoring From Backup
Restoring the files from backup is quite similar to uploading the files to the server. To do this, you need to transfer the archive file to the destination server in the /home folder. Transferring through SCP is easiest and quickest. Alternatively, you can use the following command to transfer the files:
#scp filename user@ipaddress:/home
If you do not have access to both SSC servers, to transfer the files manually through a file manager. For this, the files stored in the public_html directory of your website.
Once the archive file fully transferred to the /home folder, you can run following commands to locate the files:
Configuring the changes:
Browse your website, Once the restore is done. However, there are instances when you face some errors. Here are some of the common errors you may face and that need to be configured:
if you receive a error like “Error establishing a database connection” or “Warning: mysql_connect(): Access denied for user: ‘db_username@localhost' (Using password: YES) in /home/username/public_html/includes/db.php on line 19” “Unable to connect to database server!”, Your website fails to communicate with the database due to wrong account credentials. To resolve this issue, reconfigure your website database and assign a database username. To do this, follow these steps:
Login to your cPanel account and click “MySQL Database.”
Scroll down to MySQL Users -> NewUser
Enter any username and password twice, and click “ Create User ” button
This will create a new user, but you still need to assign it to the database. In the same area, a section called “ Add User To Database ”. Choose the username you have created from the drop-down. Then select the name of your database and click the “ Submit ” button. If you are not sure about the database name, skip the step for now.
Now you need to configure the database. To do this, follow these steps:
Go to the configuration file and select “ Edit .”
Search the code for the database name. You see something like this:
The database name contains your new cPanel name in first part. Change the first section before the underscore and leave everything else unchanged.
Set the database username and password.
Save the file.