How to fix the error in database connection for Joomla!

Last modified by Belgiun Bryan Madriaga on 2015/09/30 10:35

Source: www.inmotionhosting.com

1. Database connection error (2): Could not connect to MySQL.

Problem: 
This error message generally means that your Joomla's configuration.php file has either the wrong database name or database username. If you changed both the database username and password, and in each separate occasion the same error message occurred.
1.jpg

Solution: 
You should review your configuration.php file and ensure you are using the correct MySQL username and password. These settings will appear in the file as:

public $user = 'userna5_dbuser';
public $password = 'dbpass';

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

2. Database connection error (3): Could not connect to database

Problem: 
This error message usually means that you are connecting to the wrong database server. For most Joomla installations, the joomla files themselves and the database it connects to are on the same server. When this is the case, "localhost" should be used the database server. We recreated this error message by setting the database host to "localhosttt" (localhost spelled wrong).2.jpg

Solution: 
If your Joomla site is setup like most, check your configuration.php file and ensure your database host is set properly. Remember that the value of the $host differs depending on which GWHS server your site is currently hosted.

If the site is hosted under the GWHS Development server:

public $host = 'localhost';

If the site is hosted under the GWHS Production 01 server:

public $host = 'gwhs-db1.i.gov.ph';

If the site is hosted under the GWHS Production 02 server:

public $host = 'gwhs-db2.i.gov.ph';

3. MySQL server has gone away

Problem: 
The "MySQL server has gone away" error generally means that there is a problem with MySQL on the server, therefor it is unavailable for use. In our testing environment, we shut down MySQL and received such a warning.3.jpg

Solution: 

Most often, if Joomla has been working fine and suddenly stops working due to a database error, there is a problem with the database on your server. If you have recently made a change to Joomla and then you begin to see database errors, you should first check your database settings in your configuration.php file.

4. GWHS Helpdesk

If the error on your database connection still persist, you may contact ICT Office through the following details:

Tel: 920-0101 loc. 2002/2622
email: helpdesk@i.gov.ph
Or create a ticket on helpdesk.i.gov.ph and our technical staff will provide you assistance.

Tags:
Created by Belgiun Bryan Madriaga on 2015/04/07 08:53