09-08-2023, 01:20 PM
To manage database access and ensure proper data organization, you will need multiple PostgreSQL users. The easiest way to create one is to use the interactive mode. Here are the steps:
Switch to the postgres user:
sudo su - postgres
Run this command to create a new user:
createuser --interactive
Enter the new PostgresQL account name. For this tutorial, it is TheNewUser.
To validate the new role, log in to PostgreSQL with the postgres account:
sudo -u postgres psql
Check all the users with the following command:
\du
As shown in the output, the database successfully creates TheNewUser.


