One, set the super user password
1 Modify pg_hba.conf to enable Superuser Postgres to log in to the database
Host All 127.0.0.1/32 Trust
2 Modify Postgres Password
127.0. 0.1 psql (9.6. 4 "help" for help.postgres=# 'new Password';
ALTER ROLE
3 Modify pg_hba.conf access mode MD5
Host All 127.0.0.1/32 MD5
Common ident default to use with indent.conf
Trust does not require a password
Reject refused
Password Password access plaintext
MD5 Password Access Encryption * *
4 Test Login
127.0. 0.1 for user postgres:psql (9.6. 4"help" for help.postgres=#
Second, new user and authorization
There is no difference between user and role in Postgres, user has one more login access right than role
postgres=# CREATE USER user1; Create Rolepostgres=# CREATE DATABASE db1; CREATE database Postgres=# GRANT All on the database db1 to User1; GRANT
postgres=# REVOKE all on the DATABASE db1 from User1;
REVOKE
Postgresql User Management