Such error occurs when you have entered an incorrect database connection details in the configuration file of your site,
You can check and verify the database details from your configuration.php file located inside site root folder.
public $host = ‘localhost’;
public $user = ‘root’;
public $password = ”;
public $db = ‘joomla3.0′;
public $dbprefix = ‘jos_’;
The above values are entered as an example, Please make sure that above-mentioned details are matching with your database connection string