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:

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Lxadm.com.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.