As for creating a new user for your PostgreSQL database from the command prompt, try the following instructions:
After finishing the PostgreSQL installation, make sure you check and copy the Installation Directory, in my case, is 'C:\Program Files\PostgreSQL\13'.
Then follow 'Mycomputer => properties => advanced system settings=> Environment Variables => System Variables', select 'Path' and click 'Edit', in which you`ll addin path 'C:\Program Files\PostgreSQL\13\bin' and 'C:\Program Files\PostgreSQL\13\lib' and save change.
Next open command prompt:
cd C:\
psql --version
you`ll see the psql version that installed, with all is set:
psql -U Postgres
the command above connect you to the Database Superuser: Postgres, after applying the password that you create during the process of installation.
psql (13.1)
Type "help" for help.
postgres=#
comments above inform you`re connected.
Now create a new user and database in commands:
create database yourdatabasename;
create user yourusername with password 'password';
Apply your own name and password, and don`t forget the semicolon ';',
you can also check the List of databases:
\l
The last thing you need to do is to grant privilege for the new database to the new user:
grant all on database yourdatabase to yourusername;
If you want to connect to the database you`ve just created:
\q
to exit, and then,
psql -d databasename -U username