In case you are using joomla for your website and you are managing it using WHM/Cpanel, for you to restore your database of your site, you may follow the steps mentioned below.
First make sure that you have the backup of the database intact, a file with the extension .sql something similar to “your_database_backup.sql”
Note : Kindly note down the Database name , Username and password that you are going to create in the following steps which is very important.
- Open your cPanel dashboard, open My Sql Databases under Databases.
- Under create a new database, type in the name of your database in the space provided and CLICK on Create Database.
Note: In Cpanel the prefix will be set automatically. You just need to type in the name of the database. ie something like “yourdomain_thedatabasename”.
- Under Add a new user type in the username that you require.
- You may add a password for the user that you are creating, its always advised that you maintain a strong password. Then CLICK on Create a new User.
- Under Add a user to a database, select new user that we just created from the drop down and the new database and click on Add.
- That will take you to another page manage user privileges, select All Privileges and then CLICK on Make changes.
Thus you have created a database so that you may restore “your_database_backup.sql” for that Login to your server as root user through command line, and follow these steps.
- Change your directory to where “your_database_backup.sql” lies.
- Then execute the following command, mysql yourdomain_thedatabasename < your_database_backup.sql
Note : In the above command “yourdomain_thedatabasename” refers to the new database that you created using cPanel. Thus by executing the above command the backup file “your_database_backup.sql” is restored to the new database.
Now we need to make changes to the configuration.php file of joomla to update the changes we made. You can find the configuration.php file under /home/youraccount/public_html/configuration.php.
Open configuration.php and make the following changes,
public $user = ‘yourdomain_newuser';
public $password = ‘newpassword';
public $db = ‘yourdomain_thedatabasename';
Thats pretty much it. The site must load fine. Sometimes you may get a common issue with joomla “Error displaying the error page: Application Instantiation Error” . This may be due to the following reasons
1. Mismatch between th entries in configuration.ini file and the actual values in terms of
$user , $password , $db. Confirm the values again.
2. Database issues, which can be dealt by repairing the database from the cPanel.
3. Or sometimes the value “ public $dbtype = ‘mysqli’ “ in configuration.ini, try changing
the value to “ public $dbtype = ‘mysql’ “ .
This should fix most of the cases that shows “Application Instantiation error”