PostgreSQL uses the roles concept to manage database access permissions. A role can be a user or a group, depending on how you setup the role. A role that has login rights is called user.
\du+
select * from pg_roles;
CREATE ROLE myusername WITH LOGIN PASSWORD 'mypassword' SUPERUSER CREATEROLE CREATEDB REPLICATION;
Alternative options...
CREATE USER myusername WITH LOGIN SUPERUSER ENCRYPTED PASSWORD 'mypassword';
The recommended method is to create a file called .pgpass in your home directory. There is no obfuscation so make sure it is secure (at least: chmod 600). The file should contain a line for each hostname/port/database/username/password combination you will use. These need to match the values you will pass on the command line.
hostname:port:database:username:password
SET password_encryption = 'scram';
CREATE ROLE myrole PASSWORD 'mypassword';
SELECT substring(rolpassword, 1, 14) FROM pg_authid WHERE rolname = 'myroole';