Restore File and SQL Manually

WARNING: Kindly note that this tutorial is meant for reference. Some of these commands may be dangerous to be handled by a non-experience server admin/user and could lead to loss of data, and a non-functional server that may require reinstallation. Use the tutorial/command below at your own risk.



In WHM > Terminal


--

To get the document root of the domain


grep domainname /etc/userdatadomains


--

Step 1: Go to the domaindocumentroot


Example: cd /home/cpanelusername/public_html/


Step 2: Dump MYSQL


mysqldump sqlname > sqlname.sql


Step 2.5: Rename the folder and re-create another folder with same name with the previous name


Step 3: Find the backup folder


cd /home/backup
cd backupdate
cd accounts
cd accountsusername
cd homedir
cd domainnamedocumentroot


--

Step 4: After you have found the file backup, kindly run the RSYNC command


rsync -avzp /backupfolderfulllpath/ /exactdocumentrootpath/


To check the backup folder full path, kindly run this command pwd


Example of the path that you will get: /home/backup/2023-02-22/accounts/mangasy/homedir/public_html


Step 5: Drop MYSQL database


Go to cPanel > PhpMyAdmin > Choose the database > Check all table > Drop




Step 6: Find the backup SQL file


cd home/backup
cd bacukpdate
cd accountusername
cd mysql


Step 6: Import the database sql file


mysql sqlname < sqlname.sql


--

Step 7: Fix the folder permission (make sure you are in right path before running the command)


cd /home/cpanelusername/
chown -R cpanelusername:cpanelusername domaindocumentroot


Step 8: Change the permission file from 750 to 755


chmod 755 public_html

Updated on: 26/02/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!