How to Find the Database Host for a Joomla Installation

The database host tells Joomla where the database server is running. On many hosting accounts it is localhost, but that is not universal. Managed hosting, clustered platforms, containers, and remote database services may use a hostname such as mysql.example.net, a private DNS name, or an IP address. Use the value supplied by the environment rather than guessing.

If you are installing Joomla now

Check your hosting control panel or the database-creation screen first. Look for a value labelled Database Host, Hostname, MySQL Host, Database Server, or similar. If the provider explicitly says to use localhost, enter that in Joomla's Database Configuration screen. If it supplies another hostname, copy that value exactly.

The website's domain name is usually not the database host. Likewise, the database name and database username are separate values.

Find the host on an existing Joomla site

If Joomla is already installed, the authoritative value is in the site's configuration.php file. Open the file in the Joomla root and locate the database host property. A typical entry looks like:

public $host = 'localhost';

Do not publish or casually share the rest of configuration.php; it also contains database credentials and other sensitive settings.

You can also review the database settings in Joomla's Global Configuration on the Server tab. Treat these settings carefully: changing a working database host can immediately prevent Joomla from connecting to its database.

How to verify the value

The best verification is a successful connection using the same host, database name, username, and password that Joomla will use. During a new installation, Joomla tests the connection before it can create its tables. If the installer reports that it cannot connect, re-check all four values before assuming the hostname is wrong.

If your host provides command-line database access, a MySQL/MariaDB connection test commonly takes this form:

mysql -h DATABASE_HOST -u DATABASE_USER -p DATABASE_NAME

That command prompts for the password rather than placing it in shell history. On managed hosting you may not have shell access; the provider's database-management interface is enough.

When localhost does not work

  • Use the provider's exact database hostname. Some platforms keep the web and database servers separate.
  • Check account-specific prefixes. Hosting panels may alter database and user names even though the host remains unchanged.
  • Check remote-access rules. A remote database may only accept connections from approved hosts or networks.
  • Check the database service. Correct credentials cannot connect if MySQL, MariaDB, or PostgreSQL is unavailable.
  • Do not substitute the public website URL. https://example.com is a web URL, not a database hostname.

Verify after installation

After Joomla installs, confirm the site and Administrator both load normally. If Joomla later reports a database connection error, compare the current server details with the values in configuration.php. A host migration or database-server change can require a new host value.


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.

Open a Support Ticket