-
Download the ZIP file from https://www.enterprisedb.com/download-postgresql-binaries
-
Unzip the archive into a directory of your choice (the archive is created such that unzipping it, it will create a directory
pgsqlwith everything else below that) -
Run
initdb(this can be found in the subdirectorypgsql\bin)initdb -D c:\Users\Arthur\pgdata -U postgres -W -E UTF8 -A scram-sha-256This will create the postgres “data directory” (aka the “cluster”) in
c:\Users\Arthur\pgdata. You need to make sure that the user running this command has full read/write privileges on that directory.-U postgrescreates the superuser aspostgres,-Wwill prompt you for the password of the superuser,-E UTF8will create the database withUTF-8encoding and-A scram-sha-256enables the password authentication. -
To start Postgres, run:
pg_ctl -D c:\Users\Arthur\pgdata -l logfile startthis has(!) to be done as the user who ran
initdbto avoid any problems with the access to the data directory. -
To shutdown Postgres, run:
pg_ctl -D c:\Users\Arthur\pgdata stop -
psql.exe(the command line client) is located in thebindirectory. Starting with Postgres 9.6 the pgAdmin executablepgAdmin4.exeis located in the sub-directory"pgAdmin 4\bin". -
Optionally create a Windows service to automatically run Postgres (must be run using a Windows administrator account)
pg_ctl register -N postgresql -D c:\Users\Arthur\pgdata