Joomla stores its configuration in the Global Configuration panel. If you need to change database settings (for example, after migrating to a new server or updating credentials), you can do so directly from the Joomla administrator interface or by editing the configuration file.
Why Change Database Settings?
-
Migrating Joomla to a new hosting account or server.
-
Updating database username or password.
-
Switching between MySQL, PostgreSQL, or MSSQL.
-
Correcting connection errors after a hosting change.
Steps to Change Database Settings in Joomla
Method 1: Using Joomla Administrator
-
Log in to your Joomla site with an administrator account.
-
On the top menu bar, click System → Global Configuration.
-
Select the Server tab.
-
Under Database Settings, you can update:
-
Database Type → Choose MySQL, MySQLi, or PostgreSQL.
-
Host → Usually
localhostunless your database is on a remote server. -
Database Username → The username for your Joomla database.
-
Database Password → The password for the database user.
-
Database Name → The name of your Joomla database.
-
Database Table Prefix → Prefix applied to all Joomla tables.
-
-
Save changes.
Method 2: Editing configuration.php
If you cannot access the Joomla admin panel, you can edit the configuration file directly:
-
Log in to your hosting account via cPanel File Manager or SSH.
-
Navigate to your Joomla installation directory.
-
Open the
configuration.phpfile in a text editor. -
Locate the following lines and update them as needed:
public $dbtype = 'mysqli'; public $host = 'localhost'; public $user = 'db_username'; public $password = 'db_password'; public $db = 'db_name'; public $dbprefix = 'jos_'; -
Save the file and exit.
Important Notes
-
Always back up your site and database before making changes.
-
Ensure the database user has the correct privileges (SELECT, INSERT, UPDATE, DELETE).
-
If you change the table prefix, update extensions and modules accordingly.
-
Clear Joomla cache after making database changes.