How to manage PostgreSQL databases and users in cPanel

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

  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.

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

  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.

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

  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.

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

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

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

    You cannot use capital letters in a PostgreSQL database name.
  4. Click Create Database.

    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
Managing PostgreSQL user permissions can be tricky. You should import all PostgreSQL data as the primary PostgreSQL user (that is, by using your A2 Hosting 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.
    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

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

  3. Under Current Databases, locate the user that you want to remove, and then click the trash can cPanel - Databases - Delete icon 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.

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

  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.

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.