Categories

Featured templates

Joomla Troubleshooter. How to fix database connection errors

Amina Freinger November 19, 2014
Rating: 3.8/5. From 4 votes.
Please wait...

This tutorial is going to show you how to fix database connection errors that you can get during Joomla engine or template installation.

Joomla Troubleshooter. How to fix database connection errors

If you see "Database connection error (2): could not connect to mysql" error message on your site, it generally means that your Joomla configuration.php file has either the wrong database name or the wrong database username. To fix the error you should review your configuration.php file and ensure you are using the correct MySQL username and password. Please, perform the following steps:

  1. Connect to your FTP account or open the File Manager. In the root folder of the Joomla installation find configuration.php file.

  2. Open this file with any code editor and check your database details. These settings will appear in the file like:

    	public $user = 'amina';
    	public $password = '784512';
    
  3. Please compare the database username and password with those you used for Joomla installation, they should match. If not, correct them in your configuration.php file. Don’t forget to save changes.

    If you are sure the settings are correct, it is recommended that you reset your database user password and update the configuration.php file with the new password. This will help to ensure that you have the correct database password set.

  4. Refresh the page and check your site. It should work properly now.

If you see "Database connection error (3): Could not connect to database" error message on your site, that usually means you are connecting to the wrong database server. For most Joomla installations, the Joomla files themselves and the database connect to the same server. In such cases, "localhost" should be used as the database server.

To fix the error, check your configuration.php file and ensure your database host is set to “localhost”. If it does not help, you can check your database server name in the phpMyAdmin panel above the top menu. See the screenshot below:

joomla_database_connection_error1

  1. Blue marked item is the database server name.

  2. Green marked item is the database name.

You can also receive "Error displaying the error page: Application Instantiation Error: Could not connect to MySQL" error message. In this case you should check all database details in the configuration.php file: database user, database password, database name and database server name. See the screenshot below:

joomla_database_connection_error2

This is the end of the tutorial. Now you know how to fix database connection errors.

Feel free to check the detailed video tutorial below:

Joomla Troubleshooter. How to fix database connection errors

Beautiful Joomla Templates
This entry was posted in Joomla! Tutorials and tagged connection, database, error, fix, joomla. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket