Tuesday, March 20, 2018

Create New User for a Postgres DB

To create a new user for a Postgres DB and allow it to access a database,  Commands are:-

Switch to Postgres User:-  sudo su postgres

To Create a User with Password:-
CREATE ROLE 'shiprauser' LOGIN PASSWORD 'shiprauserpassword';

To Create a Database with Owner:-
CREATE DATABASE shipradb OWNER shiprauser ENCODING 'UTF8';

To Grant all privileges on Database:-
 grant all privileges on database shipradb to shiprauser; 

No comments:

Post a Comment