> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Managing PostgreSQL databases and users in cPanel

> Master cPanel for PostgreSQL management: create, repair databases, and manage users effortlessly.

This article describes how to use cPanel to manage PostgreSQL databases and users.

## Managing database users

To access PostgreSQL databases, you must first create at least one user. The following procedures describe how to manage PostgreSQL database users using cPanel.

### Creating a database user

To create a PostgreSQL user, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. On the **Tools** page, in the **Databases** section, click **PostgreSQL Databases**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-databases-postgresql-databases-icon.png)

3. Under **Add New User**, in the **Username** text box, type the PostgreSQL username.

4. In the **Password** text box, type the user password.

5. In the **Password (Again)** text box, retype the user password.

   > 👍 Tip
   >
   > You can click **Password Generator** and cPanel generates a random, strong password for you.

6. Click **Create User**. cPanel creates the database user.

### Changing a user's password

You can change a database user's password. You may want to do this for security reasons (changing passwords periodically is a good security practice), or you may need to do this if you forget the password.

To change a PostgreSQL user's password, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. On the **Tools** page, in the **Databases** section, click **PostgreSQL Databases**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-databases-postgresql-databases-icon.png)

3. Under **Current Users**, locate the user for which you want to change the password, and then click **Change Password**.

4. In the **Password** and **Password (Again)** text boxes, type the new password.

   > 👍 Tip
   >
   > You can click **Password Generator** and cPanel generates a random, strong password for you.

5. Click **Change Password**. The new password takes effect immediately.

### Renaming a user

To rename a PostgreSQL user, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. On the **Tools** page, in the **Databases** section, click **PostgreSQL Databases**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-databases-postgresql-databases-icon.png)

3. Under **Current Users**, locate the user that you want to rename, and then click **Rename**.

4. In the text box, type the new name, and then click **Proceed**.

5. In the **Password** and **Password (Again)** text boxes, type the password for the user, and then click **Change Password**.

   > 👍 Tip
   >
   > You can use the same password—you do not have to specify a new password.

6. Click **OK**. cPanel renames the user.

### Deleting a user

To delete a PostgreSQL user account, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. On the **Tools** page, in the **Databases** section, click **PostgreSQL Databases**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-databases-postgresql-databases-icon.png)

3. Under **Current Users**, locate the user that you want to delete, and then click **Delete**.

4. Click **Remove User** to confirm the deletion.

## Managing databases

After you create a database user, you are ready to create a database and associate the user with the new database.

### Creating a database

To create a PostgreSQL database, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. On the **Tools** page, in the **Databases** section, click **PostgreSQL Databases**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-databases-postgresql-databases-icon.png)

3. Under **Create New Database**, in the **Database Name** text box, type the name of the database.

   > 📘 Note
   >
   > You cannot use capital letters in a PostgreSQL database name.

4. Click **Create Database**.

   > 📘 Note
   >
   > When you create a database, your username is added to the database name. For example, if your username is *username*, and you create a database named *database*, the actual PostgreSQL database name is *username\_database*.

### Adding a user to a database

<Note>
  Managing PostgreSQL user permissions can be tricky. You should import all PostgreSQL data as the **primary** PostgreSQL user (that is, by using your hosting.com account username). If you import PostgreSQL data as a regular user, you will be unable to see or manipulate the data properly using phpPgAdmin. After you have imported the data as the primary PostgreSQL user, you can create a regular database user and grant the user access to the data. Then you do not have to use the primary domain username and password in scripts that access the database.
</Note>

To add a PostgreSQL user to a database, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. On the **Tools** page, in the **Databases** section, click **PostgreSQL Databases**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-databases-postgresql-databases-icon.png)

3. Under **Add User to Database**, in the **User** list box, select the user that you want to add.

4. In the **Database** list box, select the database.

5. Click **Submit**.

### Removing a user from a database

When you remove a user from a database, the user is no longer able to access the database.

To remove a PostgreSQL user from a database, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. On the **Tools** page, in the **Databases** section, click **PostgreSQL Databases**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-databases-postgresql-databases-icon.png)

3. Under **Current Databases**, locate the user that you want to remove, and then click the trash can ![](https://static.hosting.com/kb/kb-cpanel-78-databases-delete-icon.png) icon.

4. Click **Delete User from Database**. cPanel removes the user from the database.

### Deleting a database

Before you delete a database, make sure that you have a backup copy if you want to save any information that it contains.

<Note>
  When you delete a database, its associated users are not deleted. However, all permissions that users have for that database are deleted.
</Note>

To delete a PostgreSQL database, follow these steps:

1. Log in to cPanel.
   > 📘 Note
   >
   > If you do not know how to log in to your cPanel account, please see [this article](/docs/accessing-cpanel).

2. On the **Tools** page, in the **Databases** section, click **PostgreSQL Databases**:\
   ![](https://static.hosting.com/kb/kb-cpanel-jupiter-databases-postgresql-databases-icon.png)

3. Under **Current Databases**, locate the database that you want to delete, and then click **Delete**.

4. Click **Delete Database**. cPanel deletes the database.

## More information

For more information about PostgreSQL, please visit [http://www.postgresql.org](http://www.postgresql.org).

## Related articles

* [Accessing phpMyAdmin and phpPgAdmin](/docs/phpmyadmin-and-phppgadmin)

* [Managing MySQL databases and users](/docs/managing-mysql-databases)
