PostgreSQL creating user, database and adding access
Short article on how to create a user, database and how to give access to users and database
Step 1 : Login to PostgreSQL's psql
utility
psql
utility$ sudo -u postgres psql
Step 2 : Create a database
CREATE DATABASE <dbname>;
Step 3 : Create a user
CREATE USER <user_name>;
Step 4 : Create a password for new user
ALTER USER <user_name> WITH encrypted password '<password>';
Step 5 : Grant privileges to database
GRANT ALL PRIVILEGES ON DATABASE <dbname> TO <user_name>;
Last updated