Skip to main content

Joomla Error Messages

Could not connect to MySQL

When you see a white screen saying "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. In this 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 you can no longer log into the administrator environment in this case, 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

Need help solving this problem?

Jeroen Moolenschot

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!

Popular articles

Sorry, your PHP version is not supported

From Joomla 4 onwards, you can no longer use PHP versions lower than 7.2 . In Joomla 5, the minimum…

Cannot write to log file

When someone tries to log in with incorrect login credentials in the administrator area of Joomla…

You are a spammer, hacker or an otherwise bad person

The message "You are a spammer, hacker or an otherwise bad person" is not coming from Joomla itself…

JFolder::create: Could not create directory

"JFolder :: create: Could not create directory" is a common error message. You may encounter this e…

We have detected that your server uses PHP which is outdated

When you log into Joomla, you may see a yellow or red warning about the PHP version you are using…

Save failed with the following error: Null primary key not allowed

While saving an article, you encounter this error message "Save failed with the following error: Nu…