How to create PostgreSQL user with read and write privileges

This article explains the queries to create a PostgreSQL user with read and write privileges on specified database.

Step1: Login to PostgreSQL shell as postgres user via psql.

Step2: Create the new user.

>CREATE USER username WITH PASSWORD 'password';

Here username and password need to be replaces with required values.

Step3: Assign all privileges to user on database.

>GRANT ALL PRIVILEGES ON DATABASE "database" to 'username';

Here database and username need to be replaced with corresponding values.

That's all…

Leave a Reply