This guide shows you how to create a new PostgreSQL database user in cPanel and grant it access to an existing database. You'll use the PostgreSQL Databases interface to add the user and assign the necessary permissions.
How to do it
-
Step 1: Navigate to PostgreSQL Databases
Log in to your cPanel account using your web browser. Once logged in, find the Databases section on the main dashboard. Click on the PostgreSQL Databases icon to open the interface dedicated to managing your PostgreSQL databases.
-
Step 2: Create the new user
In the PostgreSQL Databases interface, locate and click on the Add New User section. Here, you will need to enter a username and password for your new database user.
Important: The username must include your cPanel username as a prefix (e.g., if your cPanel username is
internetport, the full username could beinternetport_dbuser). This ensures that the user is properly associated with your account.For security reasons, it's recommended to use a strong password. Consider using a combination of uppercase and lowercase letters, numbers, and special characters. You can also use cPanel’s password generator for assistance in creating a secure password.
-
Step 3: Add the user to a database
Once you have created the new user, scroll down to find the Add User to Database section. Here, you will see two dropdown menus. The first menu lists all the PostgreSQL databases available under your cPanel account. Select the database to which you want to add the new user.
The second dropdown menu contains a list of all users that have been created in your cPanel account. Select the newly created user from this list. After selecting both the database and the user, click on the Submit button to proceed.
-
Step 4: Set privileges
After clicking Submit, you will be redirected to a page where you can set the permissions for your new user. You will see a table listing all available privileges and checkboxes next to each one.
Select the appropriate permissions based on what you need the user to do with the database. If you want the user to have full control over the database, including creating tables, inserting data, and modifying the schema, check the box for ALL PRIVILEGES.
Once you have selected the necessary permissions, click on the Make Changes button at the bottom of the page to apply the changes.
Tips:
- Always ensure that your database users have only the permissions they need. This minimizes security risks and prevents accidental data modifications or deletions.
- If you are unsure about which privileges to assign, it might be helpful to consult with a database administrator or refer to PostgreSQL documentation for guidance.