PostgreSQL: create a user with password and assign it to a database

To create a database user in PostgreSQL, do:


Then, to create a database and assign our user to it:


To verify - try connect using a wrong password:


This is connecting with a good password: