PostgreSQL is the database that powers everything from side projects to Fortune 500 backends. If you develop on Windows 11, installing it locally with pgAdmin, the official graphical admin tool, gives you a full development database in under 15 minutes. This guide walks through the complete setup: the official EDB installer, pgAdmin configuration, command-line access, and a first database with a table you can query.
Prerequisites
- A 64-bit Windows 11 PC with at least 4 GB of free disk space (PostgreSQL plus pgAdmin needs roughly 400 MB installed, plus room for your data).
- An administrator account, because the installer registers PostgreSQL as a Windows service.
- A working internet connection for the download.
Step 1 — Download the official PostgreSQL installer
Go to postgresql.org/download and click the Windows link. This takes you to the EDB download page, the only vendor whose installer is linked from the official site. Download the newest major version (PostgreSQL 18 at the time of writing), 64-bit. The file will be named something like postgresql-18.6-1-windows-x64.exe and is roughly 380 MB.
Why EDB and not a third-party mirror: the EDB installer bundles the server, pgAdmin 4, Stack Builder, and the command-line tools in one signed package. Download portals that repackage the installer add nothing except risk.
Step 2 — Run the installer as administrator
Right-click the downloaded .exe and choose Run as administrator. Click through the welcome screen. On the component-selection screen, leave all four items checked:
- PostgreSQL Server — the database engine itself.
- pgAdmin 4 — the graphical admin client this guide uses.
- Stack Builder — optional add-ons (you can uncheck it, but it costs nothing to keep).
- Command Line Tools — gives you
psql,pg_dump, and friends.
Step 3 — Choose the data directory
The installer suggests C:\Program Files\PostgreSQL\18\data. Keep the default unless you have a reason not to, like a larger data drive. This folder holds every database file, so do not place it somewhere that gets wiped by cleanup tools.
Step 4 — Set the postgres superuser password
The installer creates a superuser called postgres. Enter a strong password and store it in a password manager. You will need it whenever pgAdmin connects to the server.
Why this matters: the postgres account can create databases, add users, and change any setting. A weak password on a machine you later expose to a network is a genuine security hole.
Step 5 — Pick the port
Leave the port at the default 5432 unless another application already uses it. The most common conflict is another PostgreSQL install, Docker Desktop running a database, or software like Tableau or some VPN clients that squat on 5432. If the port is taken, use 5433 and write it down, because you must tell pgAdmin and psql the non-default port later.
Step 6 — Choose the locale and finish
Accept the default locale (it matches your Windows region settings). Click through the pre-installation summary and let the installer run, which takes two to five minutes. When it asks whether to launch Stack Builder at the end, uncheck it, unless you want to browse optional add-ons right now.
Step 7 — Add PostgreSQL tools to your PATH
By default, psql is not on your PATH, so typing it in PowerShell fails with a "not recognized" error. Fix it once:
- Press Win + S, type environment variables, and open "Edit the system environment variables".
- Click Environment Variables, select Path under System variables, and click Edit.
- Click New and add
C:\Program Files\PostgreSQL\18\bin(adjust the version number if you installed a different release). - Click OK on every dialog and restart any open terminals.
This single entry gives you psql, pg_dump, createdb, and the rest of the client tools from any shell.
Step 8 — Verify the installation with psql
Open a new PowerShell window and run:
psql --version
You should see something like psql (PostgreSQL) 18.6. Now connect to the server:
psql -U postgres -h localhost -p 5432
Enter the superuser password when prompted. You land at the postgres=# prompt. Run three sanity checks:
SELECT version();
This prints the server version and confirms the connection is live. Then:
\l
This lists the default databases (postgres, template0, template1). Finally, exit:
\q
If all three worked, the server is healthy.
Step 9 — Register the server in pgAdmin
Launch pgAdmin 4 from the Start menu. On first launch it asks you to set a master password; this only protects pgAdmin's own saved credentials, not the database.
- In the left tree, right-click Servers and choose Register → Server.
- On the General tab, name it
Local PostgreSQL. - On the Connection tab, set Host to
localhost, Port to5432, Username topostgres, and enter your superuser password. - Tick Save password so you are not asked every time, and click Save.
The server node expands to show databases, schemas, tables, and roles. Right-click any database and open the Query Tool to run SQL in a graphical window.
Step 10 — Create your first database and table
In the pgAdmin Query Tool (connected to the postgres database), run:
CREATE DATABASE devdb;
\c devdb
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
email TEXT UNIQUE NOT NULL,
created_at TIMESTAMP DEFAULT NOW()
);
INSERT INTO users (name, email) VALUES ('Ravi', 'ravi@example.com');
SELECT * FROM users;
Press F5 or click the lightning icon to execute. You will see one row returned. If you prefer the command line, the same script works in psql exactly as written.
What just happened: CREATE DATABASE made a new database, SERIAL PRIMARY KEY created an auto-incrementing ID column, and the final query proved the whole round trip, from client to server and back.
Verify it worked
Confirm all four of these and you are done:
psql --versionprints the installed version.psql -U postgresconnects andSELECT version();returns 18.x.- pgAdmin shows Local PostgreSQL under Servers with a green connection.
- Your
devdbdatabase anduserstable appear in the pgAdmin tree.
Also check the Windows service: press Win + R, type services.msc, and look for postgresql-x64-18. Its startup type should be Automatic, which means the database starts with Windows and is always there when your app needs it.
Common issues & fixes
1. "psql is not recognized as an internal or external command"
The bin folder is not on your PATH, or you did not restart the terminal after adding it. Re-check that C:\Program Files\PostgreSQL\18\bin is in the system PATH and open a brand-new PowerShell window. Closing and reopening Windows Terminal is not optional; the old process cached the old PATH.
2. "FATAL: password authentication failed for user postgres"
You typed the superuser password wrong, or you are connecting with the wrong user. If you genuinely lost the password, you cannot recover it; you must reset it by editing pg_hba.conf (in the data folder) to set the local trust method temporarily, restarting the service, running ALTER USER postgres PASSWORD 'new-password';, then restoring pg_hba.conf and restarting again.
3. "could not connect to server: Connection refused on port 5432"
The PostgreSQL service is not running. Open services.msc, find postgresql-x64-18, and start it. If it refuses to start, check the log file in the data\log folder; the usual cause is a stale postmaster.pid after a crash or a second server already holding port 5432.
4. pgAdmin shows "Unable to connect to server" after a password change
pgAdmin caches the old password. Right-click the server, choose Disconnect, then right-click again, choose Properties → Connection, update the password field, and reconnect. Clearing the saved password and re-entering it once is the reliable fix.
5. Installer fails with "Problem running post-install step"
This almost always means the installer was not run as administrator, or antivirus blocked the service registration. Re-run the installer explicitly with Run as administrator and temporarily allow the PostgreSQL service through your antivirus. Delete the half-installed C:\Program Files\PostgreSQL\18 folder first so stale files do not confuse the retry.
You now have a production-grade database running locally on Windows 11 with both graphical and command-line access. From here, the natural next steps are creating dedicated users per project instead of using the postgres superuser, learning pg_dump backups, and connecting your app through a standard connection string. If your team would rather have a managed or server-side PostgreSQL setup done for them, XpertBees handles database server setup, tuning, and maintenance so developers can stay focused on shipping.



