How to Fix “Could Not Connect to the Database” During Joomla Installation
If Joomla reports “Could not connect to the database” during installation, the installer has not established the database connection it needs. The fix is to validate the connection details and database service—not to recreate Joomla files or change the Super User password.
Check the four values most likely to be wrong
Return to Setup Database Connection and compare the installer with the exact values from your host or database administrator:
- Host: often
localhost, but some hosts require a specific database server name; - Username: the database account, including any hosting-account prefix;
- Password: the password for that database account;
- Database Name: the existing database Joomla should use, again including any host-added prefix.
The Joomla Super User credentials are unrelated to these values.
1. Do not assume the database host is localhost
Official Joomla installation guidance explicitly notes that the database hostname may be localhost or a provider-specific server such as a separate database host. Use the value your provider gives you. If you copied credentials from another website, verify that both sites are actually on the same database service.
2. Re-check prefixed names on shared hosting
Control panels frequently turn a short name into a full account-scoped name. For example, a database entered as joomla may be displayed as something like account_joomla. Use the full database and username shown after creation. A mismatch of one prefix is enough to trigger the connection error.
3. Reset the database password if you cannot verify it
If you are unsure of the password, reset the database user's password in the hosting panel and enter the new value in Joomla. Make sure you are changing the database user—not the Joomla administrator or hosting login. If that database user is shared by another application, changing its password can break the other application, so create a dedicated Joomla database user instead when possible.
4. Confirm the user is attached to the database
Some hosting panels separate creating a database user from assigning that user to a database. Make sure the account is associated with the intended Joomla database. If the user exists but is not allowed to access that database, Joomla cannot complete setup.
5. Check whether the database server is available
Joomla's database troubleshooting documentation lists a stopped or temporarily unavailable MySQL/MariaDB service as a common cause of connection failures. Check the hosting status page or ask the server administrator. A service outage cannot be fixed by repeatedly changing Joomla's installer fields.
6. For a remote database, check network and account-host rules
If the database runs on another server, verify that the Joomla host is permitted to connect. Firewalls, cloud security groups, database bind/listen settings, and database account host restrictions can all block an otherwise correct username and password. Ask the provider to test from the Joomla web server, not merely from your desktop.
7. Confirm the PHP database driver exists
The PHP environment used by the website needs a driver appropriate for the database. Joomla's current requirements list mysqlnd, pdo_mysql, or pdo_pgsql among the required database-driver options. If the installer cannot use the selected driver, enable the appropriate PHP extension or choose a supported database/driver combination.
Use the more specific server error when available
The generic Joomla message tells you the connection failed; the underlying database/PHP error can tell you why. Look for wording such as access denied, unknown database, connection refused, name or service not known, or a timeout. Check PHP/web-server logs or ask the host for the database connection error recorded at the same timestamp.
What not to do
- Do not delete and re-upload Joomla just because database authentication failed.
- Do not grant anonymous/public database access to make the error disappear.
- Do not use a database administrator/root account for a normal hosted Joomla site when a dedicated application account can be used.
- Do not post database passwords in public forums or ordinary screenshots.
- Do not assume a connection failure is a table-prefix problem; Joomla cannot reach the stage where the prefix matters until it has a database connection.
After the error is fixed
When Joomla accepts the connection details, continue installation. If the next error says Joomla cannot create or alter tables, that is a different problem: the connection now works, but the database user lacks privileges or the database environment is rejecting schema operations. Troubleshoot that permission error instead of undoing working connection settings.
Need More Help with Joomla?
Still having trouble? Open a support ticket with QuantaCade Support and we'll be happy to help where we can.
Support priority is given to QuantaCade products, services, and customers. However, we're also happy to assist fellow Joomla users with general Joomla questions and troubleshooting when possible.
QuantaCade is an independent Joomla extension developer and is not official Joomla support. Some issues involving third-party extensions, hosting environments, server configurations, or other systems outside our development control may be beyond what we're able to resolve.