You should check the configuration.php file of your Joomla application and make sure the following lines are correct:
var $dbtype = 'mysql';
var $host = 'localhost';
var $user = 'user_YourUsername';
var $password = 'YourPassword';
var $db = 'user_YourUsername';
var $dbprefix = 'sak_'; (dbprefix its the variable name auto declared or you will be declaring at the time of Joomla installation on your server)
You should make sure you are using the correct MySQL username and database in your configuration.php file.
You can use the MySQL Databases tool in your cPanel in order to check the correct username and database for your Joomla.
Also, make sure that your MySQL username is added to your database.
This issue can also be caused by errors within the database itself. During that time you can try restoring your Joomla database.
A Simple tip from
Ultimatecine.com
Wednesday, 25 December 2013 14:21
Solution "Database Error: Unable to connect to the database:Could not connect to database"
Written by sreeram
While accessing your joomla site it occurs Database Error: Unable to connect to the database: Could not connect to database, the solution is simple...Check the following steps
Published in
joomla