Do you have a blank page on your Joomla site showing this message?
Error displaying the error page: Application Instantiation Error: Could not connect to MySQL.
This means that Joomla can't connect to your database. Because your site's data is stored there, it is highly important to fix the connection to get your site back.
Continue reading this post to know how to fix the database connection error.
In my experience, there are two possible solutions. Depending on your situation, choose the one that suit better your needs.
Solution A) If the error is intermittent
This happens if your MySQL server is up and down unexpectedly. You would see your site working fine for some periods of time but suddenly it would return the annoying error. This may happens in a endless cycle.
In that case, report the issue to your hosting provider. They should be able to figure out a solution.
Solution B) Double check the database details
- Open configuration.php file with a code editor.
- Look for these variables:
public $host = 'your-database-host'; public $user = 'your-database-user-name'; public $password = 'your-database-user-password'; public $db = 'your-database';
Let's confirm the information is correct through your cPanel, by doing click in "MySQL Databases" section:
Look for your database ($db value) on the list, see if the $user match with "Privileged users" next to the database name:
If you are unsure about the value for $password:
- Scroll down until you reach the "Current users" section.
- Click "Set password" for the database username.
- Type the value from $password as a new password.
- Click "Change password".
The value for $host is commonly 'localhost', unless the server provides a different one.
Refresh your site and hopefully it will work this time.
About the author
Valentín creates beautiful designs from amongst the tequila plants of Jalisco, Mexico. You can see Valentín's design work all over this site and you can often find him helping members in our support forum.
Read more https://www.ostraining.com/blog/joomla/connection-error/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ostrainingjoomla+%28OSTraining+Joomla%29