In order to create a new user we should run a command (as the postgres user) directly from bash:

createuser --interactive

e.g.

createuser --interactiveEnter name of role to add (the username): myuserShall the new role be a superuser? (y/n) nShall the new role be allowed to create databases? (y/n) yShall the new role be allowed to create more new roles? (y/n) n

and to set a password issue:

psqlALTER USER myuser WITH PASSWORD 'mystrongpassword';

And now to create a new database we can issue:

createdb mydatabase

and to grant permisions to a user for a specific database we can use something like: