https://www.enterprisedb.com/download-postgresql-binaries
Create an environment variable named PG_HOME with the path to the extracted files.
Update the ´PATH´ environment variable, adding the %PG_HOME%/bin/ directory.
For the next steps use Power Shell.
Check the installed version.
postgres -V
psql -V
initdb -D $env:PG_HOME\data --username=postgres --auth=trust -E utf8
pg_ctl -D $env:PG_HOME\data -l $env:PG_HOME\log.txt start
Start pgAdmin with "$env:PG_HOME/pgAdmin 4/runtime/pgAdmin4.exe", register the local database and check the binary paths for Advanced Utilties in File > Preferences > Paths > Binary paths
Configure database, users, etc. from pgAdmin
pg_ctl -D $env:PG_HOME\data stop
To check if the server is running, use pg_isready
To avoid
Avoid warnings about the code page when starting psql on Windows.
cmd.exe /c chcp 1252
psql -U <username>
databases