# Changing database settings in Joomla

> Update Joomla's database name, user, password or host after a move or credential change, in Global Configuration or configuration.php.

Source: https://helpcenter.ruachost.com/apps/joomla/changing-database-settings-in-joomla/

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

1. Log in to your Joomla site with an **administrator account**.
2. On the top menu bar, click **System → Global Configuration**.
3. Select the **Server** tab.
4. Under **Database Settings**, you can update:

   - **Database Type** → Choose MySQL, MySQLi, or PostgreSQL.
   - **Host** → Usually `localhost` unless 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.
5. Save changes.

### Method 2: Editing configuration.php

If you cannot access the Joomla admin panel, you can edit the configuration file directly:

1. Log in to your hosting account via **cPanel File Manager** or **SSH**.
2. Navigate to your Joomla installation directory.
3. Open the `configuration.php` file in a text editor.
4. 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_';
   ```
5. 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.
