PostgreSQL vs pgAdmin 4

PostgreSQL is the actual database server. It stores tables, users, schemas, indexes, and data.

pgAdmin 4 is a graphical client. It lets you connect to PostgreSQL, browse databases, run SQL, inspect tables, manage users, and view server information.

You can use PostgreSQL without pgAdmin. You can use:

  • psql
  • DBeaver
  • DataGrip
  • TablePlus
  • Beekeeper Studio
  • VS Code database extensions
  • Application connection strings

pgAdmin is useful because it is free, official, and built around PostgreSQL workflows.

Step-by-step setup

Quick requirements

Before you start, use a supported Windows, macOS, or Linux machine, an admin-capable account for installation, enough disk space for local databases, and a password manager for the postgres and pgAdmin passwords. Plan 20 to 45 minutes for a normal local install.

Key decisions before installing

Before clicking through an installer, decide:

  • Which PostgreSQL major version do you need?
  • Do you want a GUI installer or package manager install?
  • What password will you set for the postgres superuser?
  • Will the server listen only on localhost?
  • Is port 5432 already used?
  • Do you need pgAdmin now, or only psql?

For most local development, install the latest supported major version unless your project specifies another version. As of May 2026, PostgreSQL 18 is the current major release line.

If your app, framework, or hosting provider uses PostgreSQL 16 or 17, matching that major version locally can reduce surprises. PostgreSQL major upgrades are not the same as small patch updates.

Important passwords: postgres vs pgAdmin master password

There are two passwords people often confuse.

The PostgreSQL postgres password is the database superuser password. Applications and clients may use it to connect to the local server.

The pgAdmin master password protects saved connection passwords inside pgAdmin. It does not change the PostgreSQL server password.

Keep them separate:

  • PostgreSQL user: postgres
  • PostgreSQL password: the password you set for the database user
  • pgAdmin master password: the password pgAdmin uses to protect saved credentials

Do not lose the PostgreSQL superuser password. Without it, local app connections and pgAdmin login attempts can fail.

Install PostgreSQL on Windows

The standard Windows path is the PostgreSQL download page and the EDB interactive installer.

Steps:

  1. Go to the PostgreSQL Windows download page.
  2. Choose the EDB interactive installer.
  3. Download the installer for the PostgreSQL version you want.
  4. Run the installer.
  5. Choose an installation directory.
  6. Keep PostgreSQL Server selected.
  7. Keep pgAdmin 4 selected if you want the GUI.
  8. Choose a data directory.
  9. Set a strong password for the postgres superuser.
  10. Keep port 5432 unless you know it is already used.
  11. Choose the default locale unless your project requires another.
  12. Finish installation.

After installation, open PowerShell and check:

psql --version

If PowerShell cannot find psql, add the PostgreSQL bin directory to your PATH or use the SQL Shell installed with PostgreSQL.

Common Windows paths look like this:

C:\Program Files\PostgreSQL\18\bin

The exact version folder depends on the version you installed.

Check the Windows service

Open the Services app and look for a PostgreSQL service.

From PowerShell:

Get-Service *postgres*

Start it if needed:

Start-Service postgresql-x64-18

The service name can differ by version.

Install PostgreSQL on macOS with the EDB installer

Use the EDB installer if you want the same guided experience as Windows.

Steps:

  1. Go to the PostgreSQL macOS download page.
  2. Choose the EDB interactive installer.
  3. Download the installer for your Mac architecture and PostgreSQL version.
  4. Run the installer.
  5. Select PostgreSQL Server.
  6. Select pgAdmin 4 if you want the GUI.
  7. Set the postgres superuser password.
  8. Keep port 5432 unless you have a conflict.
  9. Finish installation.

Then verify:

psql --version
psql -h localhost -p 5432 -U postgres -d postgres

If psql is not on PATH, add the installed PostgreSQL bin directory to your shell profile or use the path provided by the installer.

Install PostgreSQL on macOS with Homebrew

Use Homebrew if you prefer terminal control and easy service management.

Install PostgreSQL 18:

brew update
brew install postgresql@18

Add PostgreSQL to your shell PATH:

echo 'export PATH="$(brew --prefix postgresql@18)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Start the service:

brew services start postgresql@18

Check status:

brew services list
psql --version

If Homebrew prints an initdb instruction during installation, run the exact command Homebrew prints. Homebrew behavior can vary by formula version and local state.

Set or change the postgres password after connecting as a database superuser:

psql postgres

Then inside psql:

ALTER USER postgres WITH PASSWORD 'replace_this_with_a_strong_password';
\q

If the postgres role does not exist in your Homebrew setup, create a project-specific user instead of forcing a superuser workflow:

CREATE ROLE app_user WITH LOGIN PASSWORD 'replace_this_password';
CREATE DATABASE app_dev OWNER app_user;

Install PostgreSQL on Ubuntu Linux

Ubuntu includes PostgreSQL in its default repositories. For a simple install:

sudo apt update
sudo apt install -y postgresql postgresql-contrib

Check the service:

sudo systemctl status postgresql

Connect as the local postgres system user:

sudo -u postgres psql

Inside psql:

SELECT version();
\q

Install a specific major version from the PostgreSQL Apt Repository

Use the PostgreSQL Apt Repository when you want the PostgreSQL project's packages and a specific supported version.

Configure the repository:

sudo apt update
sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

Install PostgreSQL 18:

sudo apt update
sudo apt install -y postgresql-18 postgresql-client-18

Check status:

sudo systemctl status postgresql

Set the postgres password:

sudo -u postgres psql

Then:

ALTER USER postgres WITH PASSWORD 'replace_this_with_a_strong_password';
\q

For local-only development, keep PostgreSQL bound to localhost unless you intentionally need network access.

Set up pgAdmin 4

If pgAdmin 4 was installed with the EDB installer, open it from your application menu.

If you install pgAdmin separately, use the pgAdmin download page for your operating system or the package method recommended by pgAdmin.

On first launch, pgAdmin may ask for a master password. This protects saved server passwords inside pgAdmin. It is not the database password.

To connect to your local PostgreSQL server:

  1. Open pgAdmin 4.
  2. Right-click Servers.
  3. Choose Register > Server.
  4. In General, set Name to Local PostgreSQL.
  5. In Connection, set Host name/address to localhost.
  6. Set Port to 5432.
  7. Set Maintenance database to postgres.
  8. Set Username to postgres.
  9. Enter the postgres password you set during installation.
  10. Save.

If the connection works, you should see the server tree, databases, schemas, and roles.

Verify it works

Verify with psql

GUI access is useful, but the command line is the best installation test.

Connect:

psql -h localhost -p 5432 -U postgres -d postgres

Run:

SELECT version();
SHOW port;
\conninfo

Create a test database:

CREATE DATABASE useful_atlas_dev;
\l

Connect to it:

\c useful_atlas_dev

Create a test table:

CREATE TABLE health_check (
  id serial PRIMARY KEY,
  message text NOT NULL,
  created_at timestamptz DEFAULT now()
);

INSERT INTO health_check (message) VALUES ('PostgreSQL is working');

SELECT * FROM health_check;

Exit:

\q

If all of that works, PostgreSQL is ready for local development.

Local application connection strings

Most applications need a connection string.

Format:

postgresql://USER:PASSWORD@HOST:PORT/DATABASE

Example:

postgresql://postgres:replace_this_password@localhost:5432/useful_atlas_dev

For local app development, it is better to create an app-specific user and database:

CREATE ROLE app_user WITH LOGIN PASSWORD 'replace_this_password';
CREATE DATABASE app_dev OWNER app_user;

Then:

postgresql://app_user:replace_this_password@localhost:5432/app_dev

Avoid using the postgres superuser in application configs unless you are doing a quick throwaway local test.

Port 5432 and conflicts

PostgreSQL normally listens on port 5432.

Check from inside psql:

SHOW port;

Check from the operating system.

Windows:

netstat -ano | findstr :5432

macOS:

lsof -nP -iTCP:5432 -sTCP:LISTEN

Linux:

sudo ss -ltnp | grep 5432

If another local PostgreSQL instance already uses 5432, either stop the old one or install the new one on a different port such as 5433. If you change the port, every client must use the new port.

Start and stop PostgreSQL

Windows

Use Services, or PowerShell:

Get-Service *postgres*
Start-Service postgresql-x64-18
Stop-Service postgresql-x64-18

Replace the service name with the one on your machine.

macOS Homebrew

brew services start postgresql@18
brew services stop postgresql@18
brew services restart postgresql@18
brew services list

Linux systemd

sudo systemctl start postgresql
sudo systemctl stop postgresql
sudo systemctl restart postgresql
sudo systemctl status postgresql

Back up and restore a local database

Create a plain SQL backup:

pg_dump -h localhost -U postgres -d useful_atlas_dev -f useful_atlas_dev.sql

Create a new database:

createdb -h localhost -U postgres useful_atlas_dev_restore

Restore:

psql -h localhost -U postgres -d useful_atlas_dev_restore -f useful_atlas_dev.sql

For important data, learn pg_dump, pg_restore, custom-format backups, and major-version upgrade paths before relying on local PostgreSQL as your only copy.

Common problems

connection refused

This usually means the server is not running, is listening on a different port, or is not accepting TCP connections on localhost.

Check service status:

sudo systemctl status postgresql

On macOS Homebrew:

brew services list

Check the port:

lsof -nP -iTCP:5432 -sTCP:LISTEN

or on Linux:

sudo ss -ltnp | grep 5432

password authentication failed for user postgres

Common causes:

  • Wrong password
  • Different PostgreSQL instance than expected
  • Port conflict connecting you to another server
  • postgres role password was never set
  • pgAdmin saved an old password

Reset the password from a local trusted admin path.

On Linux:

sudo -u postgres psql

Then:

ALTER USER postgres WITH PASSWORD 'new_strong_password';
\q

Update pgAdmin's saved password after resetting it.

psql command not found

The client tools are not on PATH or are not installed.

Windows: add the PostgreSQL bin folder to PATH.

macOS Homebrew:

echo 'export PATH="$(brew --prefix postgresql@18)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Ubuntu:

sudo apt install -y postgresql-client

pgAdmin cannot connect but psql can

Check the pgAdmin connection fields:

  • Host: localhost
  • Port: 5432
  • Maintenance database: postgres
  • Username: postgres
  • Password: PostgreSQL password, not pgAdmin master password

Also clear saved passwords in pgAdmin if it keeps retrying an old one.

Another app needs network access

For local development, keep PostgreSQL on localhost. If another computer on your network must connect, you need a deliberate network configuration:

  • Change listen_addresses in postgresql.conf.
  • Add the client IP range to pg_hba.conf.
  • Open the firewall only to trusted addresses.
  • Use strong passwords.
  • Prefer VPN or SSH tunnel over exposing PostgreSQL broadly.

Do not expose a local PostgreSQL server to the public internet.

Bottom line

Install PostgreSQL first, then use pgAdmin 4 as a client. Keep port 5432 unless you have a conflict, write down the postgres password, and verify with psql before troubleshooting your application.

For Windows and macOS, the EDB installer is the easiest guided route. For macOS developers who prefer package management, Homebrew is clean. For Ubuntu, use either the default package or the PostgreSQL Apt Repository when you need a specific supported major version.