Sub topic 11
Registering a Server in pgAdmin
This chapter assumes that you know basic SQL, can identify tables and keys, and have PostgreSQL connection details. You need access to a running PostgreSQL server and permission to connect to at least one database.
Registration is a client-side connection
pgAdmin is a graphical client for PostgreSQL. Registering a server in pgAdmin does not create or start a PostgreSQL server. It saves the address and login details that pgAdmin uses to connect to an existing server.
A registered server appears in the Object Explorer tree. From there, you can open its databases, schemas, tables, views, functions, and other objects.
Create the registration
- Open pgAdmin and unlock it if it asks for the pgAdmin master password. This password protects saved connection information in pgAdmin. It is separate from the PostgreSQL password.
- In the Object Explorer, right-click Servers.
- Select Register, then Server.
- Enter a descriptive name on the General tab, such as
Local development. - Open the Connection tab and enter the PostgreSQL connection details.
| Field | Typical local value | Purpose |
|---|---|---|
| Host name/address | `localhost` | The computer running PostgreSQL |
| Port | `5432` | The PostgreSQL network port |
| Maintenance database | `postgres` | The first database pgAdmin uses to connect |
| Username | `postgres` or another role | The PostgreSQL login role |
| Password | Your role password | Authenticates the role |
The maintenance database is only the initial connection target. After connecting, you can expand the server and select another database. If your administrator gave you a different port, host, or maintenance database, use those values instead.
Select Save. pgAdmin tests the connection while opening the registered server. A successful connection expands the server tree. If the connection fails, read the error carefully. A timeout usually indicates a host, port, firewall, or server-availability problem. An authentication error usually indicates an incorrect username or password.
SSL and password choices
For a local installation, the default SSL setting often works. For a remote or managed database, the administrator may require SSL. On the SSL tab, choose the required mode, such as require, and provide certificate files if the server requires certificate verification.
Do not save a production password on a shared computer. If you save it, pgAdmin stores it for later connections, protected by the pgAdmin master password. Use a separate, least-privileged PostgreSQL role for exploration rather than an administrative role.
Verify the connection
Expand the registered server and open its Databases node. Select a database, then inspect Schemas and the public schema. If you can see database objects, the registration works. You can now open the Query Tool for that database and run a read-only query.
Exercise
Which setting should you change first if pgAdmin reports “connection refused” while connecting to a local PostgreSQL installation?
Show answer
Check that the PostgreSQL service is running and that the host and port match the service configuration, commonly localhost and 5432.