- Choose network type "PostgreSQL (TCP/IP)", enter host, user (default postgres), password and port 5432, and one database name.
- A PostgreSQL session takes a single database; if you leave it empty, libpq connects to a database named after the user.
- Without Use SSL ticked, HeidiSQL passes sslmode=disable, so servers that require TLS (most cloud services) will refuse the connection.
- With Use SSL ticked, the verification setting maps to sslmode require, verify-ca or verify-full.
- For servers behind SSH, use the "PostgreSQL (SSH tunnel)" network type and the SSH tunnel tab.
HeidiSQL PostgreSQL connection: step by step
- Open the Session manager and click New.
- Set Network type to PostgreSQL (TCP/IP).
- Enter Hostname / IP, User (new sessions default to
postgres), Password and Port (5432). - In Databases, enter the one database to open. The help page notes that PostgreSQL takes a single database here, unlike MySQL's semicolon-separated list.
- On Windows, the Library drop-down lists the bundled
libpqDLLs (the installer ships libpq 15 and 17); on Linux, installlibpq5. - If the server requires TLS, open the SSL tab first (see below). Then click Save and Open.
If you leave Databases empty, HeidiSQL passes no database name and libpq's rule applies: the database name defaults to the user name. So user postgres lands in the postgres database, while an application user without a database of the same name will get an error.
SSL: how HeidiSQL maps to libpq sslmode
This is the setting most likely to trip up a HeidiSQL PostgreSQL connection. HeidiSQL builds a libpq connection string and starts it with sslmode=disable. Only when Use SSL is ticked on the SSL tab does it replace that value according to Certificate verification, and it passes the key, certificate and CA files as sslkey, sslcert and sslrootcert. The SSL cipher field is not used for PostgreSQL.
| HeidiSQL setting | libpq sslmode | What libpq does |
|---|---|---|
| Use SSL unticked | disable | Only tries a non-SSL connection |
| Use SSL, No verification | require | Only tries SSL; checks the certificate only if a root CA file is present |
| Use SSL, Verify CA | verify-ca | Only SSL, server certificate must be issued by a trusted CA |
| Use SSL, Verify CA and host name | verify-full | As verify-ca, and the host name must match the certificate |
Connecting through an SSH tunnel
Choose the PostgreSQL (SSH tunnel) network type. On the SSH tunnel tab select the SSH executable (plink.exe ships with the Windows installer; ssh.exe also works in recent versions), then enter the SSH host and port, user, password or private key file, and a free local port. On the Settings tab, set Hostname to 127.0.0.1 (PostgreSQL as seen from the SSH server) and keep port 5432. The help page warns that tunnelling to the server's public IP instead of 127.0.0.1 is the usual cause of tunnel connection errors. SSL can be combined with the tunnel if the server insists on it.
What HeidiSQL supports on PostgreSQL
HeidiSQL started as a MySQL client and its PostgreSQL support has grown over the 12.x releases. Recent release notes include ENUM column types in the table designer and data grid (12.17), a first user manager for PostgreSQL and a fix for EXPLAIN actions on PostgreSQL and SQLite (12.21). Data browsing, editing, queries, table editing and exports work across engines, but check the release notes for PostgreSQL-specific features before relying on one. The "Redshift PG" prefix also appears in the code, matching Redshift on the supported list.
Common PostgreSQL connection errors
- The server rejects connections without encryption: tick Use SSL, because HeidiSQL otherwise sends sslmode=disable.
- The database does not exist: enter the database explicitly; an empty field means the database named after the user.
- Password authentication failed: check user, password and the server's authentication rules.
- Certificate verification failed with Verify CA or host name: provide the provider's CA file in SSL CA certificate, and connect using the host name on the certificate.
Frequently asked questions
What port does HeidiSQL use for PostgreSQL?
5432 by default. Change it on the Settings tab if your server or connection pooler listens elsewhere.
Why can HeidiSQL not connect to my cloud PostgreSQL?
Most managed PostgreSQL services require TLS. Unless Use SSL is ticked, HeidiSQL sets sslmode=disable, so the server refuses the connection. Tick Use SSL and choose a verification level.
Can one HeidiSQL session show several PostgreSQL databases?
The help page states that the Databases setting takes a single database on PostgreSQL. Create one session per database.
Does HeidiSQL support PostgreSQL over SSH?
Yes, with the PostgreSQL (SSH tunnel) network type and the SSH tunnel tab.
Is HeidiSQL a good PostgreSQL client?
It covers everyday data and structure work, but it is centred on MariaDB and MySQL. Compare dedicated tools in best PostgreSQL GUI tools.
Sources
- HeidiSQL help: connecting, SSH tunnel, command line switches
- HeidiSQL home page (supported databases, 12.17 news)
- HeidiSQL v12.21 release notes
- HeidiSQL source: connection code (dbconnection.pas)
- HeidiSQL source: session manager logic (connections.pas)
- HeidiSQL Windows installer script (bundled libpq)
- PostgreSQL documentation: libpq connection parameters
Checked 8 October 2026.
How we research tool guides: our editorial method. CodeWithSQL earns nothing from the vendors mentioned.