Skip to content
Guide · HeidiSQL

How to Connect HeidiSQL to PostgreSQL

HeidiSQL connects to PostgreSQL through libpq, using a session with the "PostgreSQL (TCP/IP)" or "PostgreSQL (SSH tunnel)" network type. The main differences from MySQL are that a session opens one database, and that SSL is either off or required: HeidiSQL sets libpq's sslmode to disable unless you tick Use SSL. This guide walks through both, based on HeidiSQL's help page and source code.

Steps and facts checked 8 October 2026 against the vendor's official documentation. Versions covered: HeidiSQL 12.21; libpq 15 and 17 bundled with the Windows installer; PostgreSQL current documentation. Next review due April 2027. Menus, shortcuts and prices change between releases; check the vendor's documentation for your version.
Short answer
  • 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.
How we know: Research-based: field names, defaults and SSL behaviour were checked against the HeidiSQL help page, the v12.21 release notes, the session and connection source code in the official GitHub repository, and the PostgreSQL libpq documentation on 8 October 2026. We have not made these connections for this guide.

HeidiSQL PostgreSQL connection: step by step

  1. Open the Session manager and click New.
  2. Set Network type to PostgreSQL (TCP/IP).
  3. Enter Hostname / IP, User (new sessions default to postgres), Password and Port (5432).
  4. 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.
  5. On Windows, the Library drop-down lists the bundled libpq DLLs (the installer ships libpq 15 and 17); on Linux, install libpq5.
  6. 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 SSL settings and the resulting libpq sslmode
HeidiSQL settinglibpq sslmodeWhat libpq does
Use SSL untickeddisableOnly tries a non-SSL connection
Use SSL, No verificationrequireOnly tries SSL; checks the certificate only if a root CA file is present
Use SSL, Verify CAverify-caOnly SSL, server certificate must be issued by a trusted CA
Use SSL, Verify CA and host nameverify-fullAs 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

Checked 8 October 2026.

How we research tool guides: our editorial method. CodeWithSQL earns nothing from the vendors mentioned.

Still choosing a SQL client?

Read the full reviews, or compare tools side by side.