Skip to main content

Could not connect to MySQL

When you see a white screen with the text "Error displaying the error page: Application Instantiation Error: Could not connect to MySQL." then no connection can be made to the database.

All Joomla content such as articles, modules and user information is stored in the database so it is important to restore the connection to get your website working again.

The problem may have 1 of the following causes:

Connection to the database is unstable

This happens when the MySQL server goes offline intermittently. Your website will work fine for some time, then it won't work and later it won't work again. In that case, report the problem to your hosting provider. They should be able to come up with a solution.

Check the database details

Go to your cPanel, DirectAdmin or Plesk environment and look up the MySQL database details (or request them from your hosting provider).

Since in this case you cannot log into the administrator environment anymore you can find these data in the "configuration.php" file.

Open the configuration.php go find these lines (in many cases they will not be listed directly together)

public $host = 'localhost'; public $user = 'username'; public $password = 'password'; public $db = 'database name';
public $dbprefix = 'jos_';


$host is "localhost" in many cases unless the hosting specifies that you should use a different value.

$user is the username and $password is the corresponding password. Also check that this user does have access to the database.

$db is the name of the database. There may be several databases installed. Check that you are trying to access the correct database.

$dbprefix is the prefix. There are several tables within a database. Each Joomla installation needs its own prefix. Check, by opening the database via PHPmyAdmin, for example, that the prefix matches the value in the configuration.php

Was this helpful? Share it with your friends!
This article was updated on: 20 December 2024

About Jeroen

I have been working with the Joomla! CMS since 2006. Besides building and maintaining Joomla! websites and webshops, I am also familiar with search engine optimization (SEO), Joomla hosting and developing templates and extensions. Furthermore, I am a frequent visitor and speaker at JoomlaDays and various Joomla user groups.

I am committed to the Joomla! community as a member of the Extensions Directory team and the organization of Joomla user group Breda and JoomlaDagen Netherlands. In short: Are you looking for a Joomla Specialist, you should contact me!