Managing PostgreSQL databases and users in cPanel

Learn how to use cPanel to manage PostgreSQL databases and database users. Get instructions on creating a database or database user, repairing a database and more.

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.

  2. Open the PostgreSQL Databases tool:

  • If you are using the Jupiter theme, on the Tools page, in the Databases section, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  • If you are using the Paper Lantern theme, in the DATABASES section of the cPanel home page, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

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

  2. In the Password text box, type the user password.

  3. 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.

  1. 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.

  2. Open the PostgreSQL Databases tool:

  • If you are using the Jupiter theme, on the Tools page, in the Databases section, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  • If you are using the Paper Lantern theme, in the DATABASES section of the cPanel home page, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

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

  2. 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.

  1. 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.

  2. Open the PostgreSQL Databases tool:

  • If you are using the Jupiter theme, on the Tools page, in the Databases section, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  • If you are using the Paper Lantern theme, in the DATABASES section of the cPanel home page, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

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

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

  3. 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.

  1. 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.

  2. Open the PostgreSQL Databases tool:

  • If you are using the Jupiter theme, on the Tools page, in the Databases section, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  • If you are using the Paper Lantern theme, in the DATABASES section of the cPanel home page, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

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

  2. 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.

  2. Open the PostgreSQL Databases tool:

  • If you are using the Jupiter theme, on the Tools page, in the Databases section, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  • If you are using the Paper Lantern theme, in the DATABASES section of the cPanel home page, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  1. 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.

  1. 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.

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.

  2. Open the PostgreSQL Databases tool:

  • If you are using the Jupiter theme, on the Tools page, in the Databases section, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  • If you are using the Paper Lantern theme, in the DATABASES section of the cPanel home page, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

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

  2. In the Database list box, select the database.

  3. 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.

  2. Open the PostgreSQL Databases tool:

  • If you are using the Jupiter theme, on the Tools page, in the Databases section, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  • If you are using the Paper Lantern theme, in the DATABASES section of the cPanel home page, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  1. Under Current Databases, locate the user that you want to remove, and then click the trash cancPanel - Databases - Delete iconicon.

  2. 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.

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.

  2. Open the PostgreSQL Databases tool:

  • If you are using the Jupiter theme, on the Tools page, in the Databases section, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

  • If you are using the Paper Lantern theme, in the DATABASES section of the cPanel home page, click PostgreSQL Databases:
    cPanel - Databases - PostgreSQL Databases icon

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

  2. Click Delete Database. cPanel deletes the database.

More Information

For more information about PostgreSQL, please visit http://www.postgresql.org.

Related Articles