PostgreSQL Databases

Valid for versions 120 through the latest version

Version:

82

120


Last modified: March 1, 2024

Overview

Use this interface to create, manage, and delete PostgreSQL® databases and database users.

To add or delete information in existing databases, copy a database, or run PostgreSQL queries and scripts, use cPanel’s phpPgAdmin interface (cPanel » Home » Databases » phpPgAdmin).

Important:

Do not use phpPgAdmin to create databases or database users.

Note:
  • This interface only appears in your cPanel account if your hosting provider installs and configures PostgreSQL in WHM’s Configure PostgreSQL interface (WHM » Home » Database Services » Configure PostgreSQL).

  • To create your first database and user, we recommend that you use the PostgreSQL Database Wizard interface (cPanel » Home » Databases » PostgreSQL Database Wizard).

  • The maximum length of a database name is 63 characters. If you enable database prefixing, this length includes the database prefix and underscore character (_).

  • To enter information in a database, use the phpPgAdmin interface (cPanel » Home » Databases » phpPgAdmin).

Create a database

To create the database, perform the following steps:

  1. In the Database Name text box, enter a name for the database.

  2. Click Create Database.

  3. Click Go Back. The new database will appear in the Current Databases table.

Current Databases

The Current Databases table lists the following information for each database in your account:

  • Database — The name of the database.

  • Size — The size of the database.

  • Privileged Users — Users who can manipulate the database.

  • Actions — Click the appropriate icon in this column to perform an action on the corresponding user or database.

Remove a user

To remove a user from a database, perform the following steps:

  1. In the Current Databases table, click Delete next to the user that you want to delete.

  2. To remove the user’s privileges to manage the database, click Yes.

Rename a database

Warning:
  • When you rename a database, the system terminates all active connections to the database.

  • You must manually update configuration files and applications to use the new database name.

  • The system requires more time to rename larger and more complex databases.

To rename a database, perform the following steps:

  1. Click Rename in the Actions column next to the database that you wish to rename.

  2. Enter the new database name in the New name text box.

  3. Click Proceed.

Delete a database

To delete a database, perform the following steps:

  1. Click Delete in the Actions column next to the database that you wish to delete.

  2. To permanently delete the database, click Delete Database.

Add a PostgreSQL user

After you create the database, add users to the database.

Note:
  • You must create a user before you can add the user to an existing database.
  • You must create PostgreSQL user accounts separately from mail and administrator accounts.

To create a new user account, perform the following steps:

  1. Enter a username in the Username text box.

    Note:

    The maximum length of a database username is 63 characters. If you enable database prefixing, this length includes the database prefix and underscore character (_).

  2. Enter and confirm the new password in the appropriate text boxes.

    Warning:

    The password must contain at least five characters.

    Note:
    • The system evaluates the password that you enter on a scale of 100 points. 0 indicates a weak password, while 100 indicates a very secure password.
    • Some web hosts require a minimum password strength. A green password Strength meter indicates that the password is equal to or greater than the required password strength.
    • Click Password Generator to generate a strong password. For more information, read our Password & Security documentation.

  3. Click Create User.

    Warning:

    Some versions of PostgreSQL are ANSI SQL-92 compliant and do not support recursive grants, wildcard grants, or future grants. To ensure that users continue to have access the information in your PostgreSQL tables, click Synchronize Grants.

    We recommend that you synchronize the grants after you take the following actions:

    • Add a new user.
    • Add an existing user to a database.
    • Create a new table manually in phpPGAdmin.

Add a user to a database

To add a user to a database, perform the following steps:

  1. Select the appropriate user and the database you want to add the user to from the User and Database menus.

  2. Click Submit.

Current Users

The Current Users table lists all of your PostgreSQL users. Use the functions in this table to change user passwords and usernames, or to delete users.

Change a PostgreSQL user password

To change a PostgreSQL user’s password, perform the following steps:

  1. In the Current Users table, click Change Password in the Actions column next to the user that you wish to change.

  2. Enter and confirm the new password in the appropriate text boxes.

    Warning:

    The password must contain at least five characters.

    Note:
    • The system evaluates the password that you enter on a scale of 100 points. 0 indicates a weak password, while 100 indicates a very secure password.
    • Some web hosts require a minimum password strength. A green password Strength meter indicates that the password is equal to or greater than the required password strength.
    • Click Password Generator to generate a strong password. For more information, read our Password & Security documentation.

  3. Click Change Password.

Change a PostgreSQL user name

To change a PostgreSQL user’s username, perform the following steps:

  1. Click Rename in the Actions column for the user that you wish to rename.

  2. Enter the new username for the account in the New name text box.

  3. Click Proceed.

Warning:

When you rename a PostgreSQL user, the Change Password interface automatically appears so you can reset the password for the database user. The md5 hash that PostgreSQL creates to store user passwords requires this step.

Delete a PostgreSQL user

To delete a PostgreSQL user account, perform the following steps:

  1. Click Delete in the row next to the user that you wish to delete.

  2. To permanently delete the account, click Remove User.

Additional Documentation