Database connection error (2): Could not connect to MySQL- Joomla Issue

While accessing the Joomla site I was getting the error as "Database connection error (2): Could not connect to MySQL"

Solution -

1. Database Credentials in 'configuration.php' file -

Please make sure that database credentials that is database username or database password which you're using in your site's configuration file is correct.

2. Below are the field which you'll need to check in 'configuration.php' file-

public $user = 'MySQL_database_username';
public $password = 'MySQL_database_password';

3. If you are not sure about the MySQL database details please reset the password and give a try. In cPanel you can reset it from -
cPanel >> MySQL Databases >> Current Users >> Change Password

It fixed my issue!

Was this answer helpful?

 Print this Article

Also Read

How to reset SSH port back to default port 22?

In some situations most of us may come across a problem that we are able to log into the WHM but...

Fatal error: Class 'JCache' not found in /libraries/joomla/factory.php - Joomla Issue

After updating the Joomla, I was getting Fatal error: Class 'JCache' not found in...

How to add/remove the trailing slashes in URLs using the .htaccess?

You can use the below code in the .htaccess file depending on the trailing slash required or not...

Failed to connect to MySQL: Access denied for user

While accessing the website, I was getting the error as -Failed to connect to MySQL: Access...

The MySQL server is currently offline. Mysql::initcache() failed: The mysql server is offline.

I was getting below error while accessing MySQL Databases from cPanel though MySQL service was...

Powered by WHMCompleteSolution