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

Access Denied. Unable to establish a PHP session.

I was getting below error while accessing phpMyAdmin - Access Denied Unable to establish a PHP...

DenyIp::adddenyip( failed: Error: while opening /home/xxx/public_html/.htaccess Error: while opening /home/xxx/public_html/.htaccess

I was getting the below error while adding an IP address from cPanel >> IP Blocker...

Forbidden. You don’t have permission to access /wp-content/uploads/file-name.pptx

While uploading the files .pptx and .ppt files from WordPress admin dashboard, I was getting the...

Response: 530 Login authentication failed Error: Critical error: Could not connect to server.

I was unable to connect to FTP using correct credentials with the below error message - Status:...

How to install Let's Encrypt free SSL plugin on cPanel server?

Let's Encrypt plugin allows automated SSL certificate for those account which do not have valid...

Powered by WHMCompleteSolution