Joomla 'Could not connect to the database' Error: How to Fix
Symptoms: Error displaying the error page: Application Instantiation Error: Could not connect to MySQL (Joomla 3) · Could not connect to the database / An error has occurred (Joomla 4/5/6) · JDatabaseExceptionConnecting in logs · Site worked before and suddenly errors
Mostly verified. cPanel labels below apply to cPanel hosts; Plesk/managed databases have equivalent steps. Researched 2026-06-01 (Joomlashack, official docs and forum).
✅ Verified on a live Joomla 5.4.6 install:
configuration.phpcontains exactly$host,$user,$passwordand$db. We reproduced this error: with a wrong$passwordand debug off, Joomla 5 shows the generic “Sorry…/500 Whoops” page (HTTP 500) — not a database-specific message. With debug on ($debug = true), the real cause surfaced:Access denied for user '…'@'…' (using password: YES).
Version note: the full wording “Error displaying the error page: Application Instantiation Error: Could not connect to MySQL.” is Joomla 3-era. On Joomla 4/5/6 a DB failure instead renders the generic “Sorry, there was a problem we could not recover from” / 500 Whoops page (we confirmed this on Joomla 5.4.6) — so you must turn on debug to confirm it’s a database problem. The underlying causes and fixes are the same across versions.
Cause 1 — Wrong credentials in configuration.php
Joomla stores its database settings in configuration.php. Check these four values:
public $host = 'localhost'; // usually localhost, but some hosts differ
public $user = '...'; // database username
public $password = '...'; // database password
public $db = '...'; // database name
Fix: cross-reference each value against your host’s cPanel → MySQL Databases:
- Confirm the database name (
$db) exists. - Confirm the user (
$user) is listed under Privileged Users for that database. - If unsure of the password, reset it in cPanel and update
$passwordto match.
If you see Error 1045 ... Access denied for user, it’s almost always a username,
password, or privilege mismatch.
Cause 2 — Unstable MySQL server at your host
If the site works, then intermittently throws the error, the MySQL server itself may be going up and down. This isn’t something you can fix in Joomla — report it to your hosting provider and ask them to investigate server stability.
Related searches
joomla could not connect to database · joomla jdatabaseexceptionconnecting ·
joomla error displaying the error page could not connect to mysql ·
joomla application instantiation error