create and attach user to a postgresql database
snippet in sql

How do I add a user to a postgres database? cli

user6977

GRANT ALL PRIVILEGES ON DATABASE yourdbname TO youruser;

create and attach user to a postgresql database

user7424

sudo -u postgres psqlpostgres=# create database mydb;postgres=# create user myuser with encrypted password 'mypass';postgres=# grant all privileges on database mydb to myuser;

How do I add a user to a postgres database? cli

user9811

psql=# grant all privileges on database <dbname> to <username>