# Finding your database details

> Where to find your MySQL database name, username, password and host in cPanel, for example when editing wp-config.php.

Source: https://helpcenter.ruachost.com/cpanel/databases/finding-your-database-details/

Your website connects to its database with four details: the **database name**, the **database username**, the **password** and the **host**. You'll need them when you set up an app by hand, move a site, or fix an "Error establishing a database connection" message.

## Database host

On Ruachost hosting, the database host is almost always:

```
localhost
```

Use `localhost` for any website or app running on your hosting account. Only use your server's hostname or IP address when you connect from **outside** the server, for example from a desktop database tool. That also needs [remote MySQL access](https://helpcenter.ruachost.com/cpanel/databases/configuring-remote-mysql-access-in-cpanel/).

## Database name and username

1. Log in to cPanel.
2. Under **Databases**, open **Manage My Databases** (called **MySQL® Databases** in some versions).
3. Your databases are listed under **Current Databases**, with the users who can access each one.

cPanel adds your cPanel username and an underscore to the front of every database and user name. For example, if your cPanel username is `ruach1` and you created a database called `shop`, its full name is `ruach1_shop`. Always use the **full** name in your website's settings.

## Database password

cPanel doesn't show database passwords. If you don't know it, set a new one:

1. In **Manage My Databases**, scroll down to **Current Users**.
2. Click **Change Password** next to the user.
3. Enter a new password (or use the **Password Generator**) and click **Change Password**.
4. Update the password in your website's configuration file straight away, or the site won't be able to connect.

## Where your website stores these details

| Application | File | Settings |
| --- | --- | --- |
| WordPress | `wp-config.php` | `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_HOST` |
| Joomla | `configuration.php` | `$db`, `$user`, `$password`, `$host` |
| Laravel | `.env` | `DB_DATABASE`, `DB_USERNAME`, `DB_PASSWORD`, `DB_HOST` |

You can open and edit these files in [File Manager](https://helpcenter.ruachost.com/cpanel/files/viewing-and-editing-files-in-cpanels-file-manager/). Some of them are hidden; see [I can't see (dot) htaccess](https://helpcenter.ruachost.com/cpanel/guides/i-cant-see-dot-htaccess/) to show hidden files.

> **Caution:**
These files contain your database password. Never share them publicly or paste them into a support forum.

## Related articles

- [Managing MySQL databases and users](https://helpcenter.ruachost.com/cpanel/databases/managing-mysql-databases-and-users/)
- [Accessing phpMyAdmin](https://helpcenter.ruachost.com/cpanel/databases/accessing-phpmyadmin-and-phppgadmin/)
- [Importing and exporting a MySQL database](https://helpcenter.ruachost.com/developers/databases/importing-and-exporting-a-mysql-database/)
