Install PostgreSQL 18 on Windows
Configure the service, port, and psql with the Windows installer linked by PostgreSQL
The PostgreSQL project links the EDB-certified interactive installer from its Windows download page. The bundle commonly includes the PostgreSQL server, pgAdmin, and StackBuilder.
Record during installation
- major version and install directory;
- data directory, outside folders controlled by consumer sync tools;
- PostgreSQL service account;
- listening port, commonly 5432;
- the
postgresadministrator password, stored in a password manager; - locale, with collation behavior tested before production migration.
Select only components you need. Extra drivers and extensions in StackBuilder are not PostgreSQL core and should follow project requirements.
Verify with psql
Open the SQL Shell installed with PostgreSQL, or add its bin directory to the current terminal path:
psql.exe --version
psql.exe -X -h localhost -p 5432 -U postgres -d postgres `
-c "select version(), current_database(), current_user;"Inspect the service through Windows Services or PowerShell:
Get-Service *postgres*If the client is missing, locate psql.exe in the installation directory; do not download standalone DLLs from an unknown source.
Common connection failures
| Symptom | Check first |
|---|---|
| connection refused | Whether the PostgreSQL service is running and the port is correct |
| password authentication failed | Username, target instance, password, and matching pg_hba.conf rule |
| database does not exist | Whether the database passed with -d was created |
| unexpected server version | Whether several PostgreSQL services are running on Windows |
Local development normally needs no inbound firewall opening. Remote access must restrict source addresses and use appropriate TLS validation. Do not replace diagnosis with a passwordless trust rule in pg_hba.conf.
Before uninstalling
Removing software and deleting the data directory are separate operations. Export required content with pg_dump plus pg_dumpall --globals-only, test a restore, and confirm the exact data directory before deletion.
Last updated on