---
title: "Creating a PostgreSQL User &#038; Adding them to a database"
description: "In this tutorial, we will show you how to create a PostgreSQL User, and then add them to a database. After getting PostgreSQL on your VPS or Dedicated server, you can create PostgreSQL users and..."
url: https://www.inmotionhosting.com/support/website/creating-users-adding-them-to-database/
date: 2014-04-15
modified: 2022-09-28
author: "InMotion Hosting Contributor"
categories: ["Website", "Working with Databases"]
type: post
lang: en
---

# Creating a PostgreSQL User &#038; Adding them to a database

In this tutorial, we will show you how to create a PostgreSQL User, and then add them to a database. After getting PostgreSQL on your VPS or Dedicated server, you can create PostgreSQL users and databases in cPanel.

- [How to Create A PostgreSQL User](#create)
- [How to Add a User to a Database](#add-user)

You must [create a PostgreSQL database](https://www.inmotionhosting.com/support/website/create-database/) before attempting this guide.

## How to Create A PostgreSQL User

1. [Login to cPanel](https://www.inmotionhosting.com/support/edu/cpanel/how-to-log-into-cpanel/).
2. Click the **PostgreSQL Databases** button in the *Databases* section.![Selecting PostgreSQL Database in cPanel](https://www.inmotionhosting.com/support/wp-content/uploads/2022/09/postgresql-databases.png)[](/support/wp-content/uploads/2014/04/postgresql_create-db_postgresql-databases.png)[](/support/wp-content/uploads/2014/04/postgresql_create-db_postgresql-databases.png)**Note:** The *PostgreSQL* button, is only available after [installing PostgreSQL](https://www.inmotionhosting.com/support/server/databases/install-setup/) on your VPS, or Dedicated server.
3. In the *Add New User* section, enter a username, then your password in the available fields. Be sure to use a [strong password](https://www.inmotionhosting.com/support/security/password-strength/).![Adding a New User in PostgreSQL](https://www.inmotionhosting.com/support/wp-content/uploads/2022/09/postgresql-databases-add-new-user.png)
4. Click the **Create User** button. You are finished when you see a message similar to this, but your actual PostgreSQL *username* and *password* will be listed: “*Added user “exampl8_username” with password “E1+q0I;1r7XT”. *“

## How to Add a User to a Database

1. [Login to cPanel](https://www.inmotionhosting.com/support/edu/cpanel/how-to-log-into-cpanel/).
2. Click the **PostgreSQL Databases** button in the *Databases* section.
3. In the *Add User To Database* section, select the **User** you want to add from the drop-down menu.[](/support/wp-content/uploads/2014/04/postgresql_db-user_postgres-config-install.png)[](/support/wp-content/uploads/2014/04/postgresql_db-user_postgres-config-install.png)
4. Choose the database you want to add the user to, from the *Database* section.
5. Click the **Submit** button.![Add New PostgreSQL User to Database](https://www.inmotionhosting.com/support/wp-content/uploads/2022/09/postgresql-databases-add-user-to-database.png)You are finished when you see a message similar to this, with your own username and password: “*User exampl8_user was added to the database exampl8_test.*“

Congratulations, now you know how to create a PostgreSQL user, and add them to a PostgreSQL database. Learn more about [PostgreSQL Hosting](https://www.inmotionhosting.com/postgresql-hosting) options.
