I resolved this issue using below options:
- Whitelist your DB host from your network team to make sure you have access to remote host
- Install postgreSQL version 4 or above
- Run below command:
psql -h <REMOTE HOST> -p <REMOTE PORT> -U <DB_USER> <DB_NAME>
PostgreSQL
postgresql.org โบ docs โบ current โบ tutorial-accessdb.html
PostgreSQL: Documentation: 18: 1.4. Accessing a Database
May 14, 2026 - The last line printed out by psql is the prompt, and it indicates that psql is listening to you and that you can type SQL queries into a work space maintained by psql. Try out these commands: mydb=> SELECT version(); version -------------------------------------------------------------------โ----------------------- PostgreSQL 18.4 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit (1 row) mydb=> SELECT current_date; date ------------ 2016-01-07 (1 row) mydb=> SELECT 2 + 2; ?column?
04:57
How To Connect/Register PostgreSQL Database Server || PostgreSQL ...
12:05
Connecting to the PostgreSQL Database | SQL Fundamentals with ...
How To Connect to PostgreSQL Database in Visual Studio ...
10:41
Connecting to a Database with pgAdmin | SQL Fundamentals with ...
04:33
5 ways to connect to Postgres - YouTube
04:39
PostgreSQL: How to Connect to Databases | Course | 2019 - YouTube
PostgreSQL
postgresql.org โบ docs โบ current โบ ecpg-sql-connect.html
PostgreSQL: Documentation: 18: CONNECT
May 14, 2026 - EXEC SQL CONNECT TO "connectdb" AS main; EXEC SQL CONNECT TO "connectdb" AS second; EXEC SQL CONNECT TO "unix:postgresql://200.46.204.71/connectdb" AS main USER connectuser; EXEC SQL CONNECT TO "unix:postgresql://localhost/connectdb" AS main USER connectuser; EXEC SQL CONNECT TO 'connectdb' AS main; EXEC SQL CONNECT TO 'unix:postgresql://localhost/connectdb' AS main USER :user; EXEC SQL CONNECT TO :db AS :id; EXEC SQL CONNECT TO :db USER connectuser USING :pw; EXEC SQL CONNECT TO @localhost AS main USER connectdb; EXEC SQL CONNECT TO REGRESSDB1 as main; EXEC SQL CONNECT TO AS main USER connect
Top answer 1 of 7
202
I resolved this issue using below options:
- Whitelist your DB host from your network team to make sure you have access to remote host
- Install postgreSQL version 4 or above
- Run below command:
psql -h <REMOTE HOST> -p <REMOTE PORT> -U <DB_USER> <DB_NAME>
2 of 7
75
psql -h <IP_Address> -p <port_no> -d <database_name> -U <DB_username> -W
-W option will prompt for password. For example:
psql -h 192.168.1.50 -p 5432 -d testdb -U testuser -W
EnterpriseDB
enterprisedb.com โบ postgres-tutorials โบ connecting-postgresql-using-psql-and-pgadmin
Connecting PostgreSQL using psql and pgAdmin | EDB
For PostgreSQL: -bash-4.2$ psql -d postgres -U postgres ยท For Advanced Server: -bash-4.2$ psql -d edb -U enterprisedb ยท If connecting to a remote server from any of the operating systems, you can pass on the specific parameters in the following format: bash-4.2$ psql -h <hostname or ip address> -p <port number of remote machine> -d <database name which you want to connect> -U <username of the database server>
Amazon Web Services
docs.aws.amazon.com โบ amazon rds โบ user guide โบ amazon rds for postgresql โบ connecting to a db instance running the postgresql database engine
Connecting to a DB instance running the PostgreSQL database engine - Amazon Relational Database Service
If the DB instance is available and accessible, you can connect by providing the following information to the SQL client application: The DB instance endpoint, which serves as the host name (DNS name) for the instance. The port on which the DB instance is listening. For PostgreSQL, the default port is 5432. The user name and password for the DB instance. The default 'master username' for PostgreSQL is postgres. The name and password of the database ...
Benburwell
benburwell.com โบ posts โบ how-i-connect-to-postgres-databases
How I Connect to Postgres Databases - Ben Burwell
December 13, 2022 - Instead of needing to remember to use ben as the username for ssh.public.net, and that sshd is actually listening on port 2222, you can add an entry to ~/.ssh/config similar to the way the Postgres service file works: ... You can actually make the Host label anything you want, it doesn't need to be the real name of the server. This can be useful if you don't actually have a DNS name to connect to and you don't want to remember the IP address: Host my-internal-net User ben Port 2222 HostName 192.0.32.7 ยท So now we can connect fairly easily to our database:
KB Hosting
kb.hosting.com โบ docs โบ connect-to-postgresql-from-the-command-line
Connecting to PostgreSQL using the command line - hosting.com
To connect to PostgreSQL from the command line, follow these steps: Log in to your account using SSH. At the command line, type the following command. Replace dbname with the name of the database, and username with the database username:
PhoenixNAP
phoenixnap.com โบ home โบ kb โบ databases โบ how to connect to a postgresql database from linux or windows
How to Connect to a PostgreSQL Database from Linux or Windows
December 12, 2025 - If you already created a different user, replace postgres in the command above with your PostgreSQL username. 3. To list existing databases, use the \l meta-command: ... 4. To switch to a different database, type \c followed by the database name. For example, to connect to the template1 database, enter:
w3resource
w3resource.com โบ PostgreSQL โบ connect-to-postgresql-database.php
Connect to PostgreSQL Database on Linux, Windows | w3resource
April 1, 2026 - Redhat based systems like Centos / Fedora : Connect/login as root - user@user-pc:~$ su - postgres user@user-pc:~$ psql psql (9.3.6) Type "help" for help. ... C:\Program Files\PostgreSQL\9.4\bin>psql -U postgres Password for user postgres: psql (9.4.1) Type "help" for help. postgres=# After accessing a PostgreSQL database, you can run SQL queries and more. Here are some common psql commands ยท To view help for psql commands, type \?.
PostgreSQL
postgresql.org โบ docs โบ current โบ libpq-connect.html
PostgreSQL: Documentation: 18: 32.1. Database Connection Control Functions
May 14, 2026 - The following functions deal with making a connection to a PostgreSQL backend server. An application program can have several backend connections open at one time. (One reason to do that is to access more than one database.) Each connection is represented by a PGconn object, which is obtained from the function PQconnectdb, PQconnectdbParams, or PQsetdbLogin.
DigitalOcean
docs.digitalocean.com โบ connect to postgresql cluster
How to Connect to PostgreSQL Database Clusters | DigitalOcean Documentation
2 weeks ago - Use the format menu in the Connection Details section to display the same connection information in one of three formats: Connection parameters: Separate fields for username, password, host, port, database, and sslmode. Use this format when your client or application expects individual connection settings, such as DataGrip or pgAdmin. Connection string: A single PostgreSQL URI (postgresql://user:password@host:port/database).
Solutions
solutions.posit.co โบ connections โบ db โบ databases โบ postgresql
PostgreSQL - Solutions - Posit
This package acts as both the database driver and the DBI interface. The code, and additional information are available in its GitHub repository here: RPostgres. To connect use: library(DBI) # Connect to the default postgres database con <- dbConnect(RPostgres::Postgres())
Supabase
supabase.com โบ docs โบ guides โบ database โบ connecting to your database
Connect to your database | Supabase Docs
8 hours ago - The Data APIs allow you to interact with your database using REST or GraphQL requests. You can use these APIs to fetch and insert data from the frontend, as long as you have RLS enabled. ... For convenience, you can also use the Supabase client libraries, which wrap the Data APIs with a developer-friendly interface and automatically handle authentication: ... The direct connection string connects directly to your Postgres instance.
PostgreSQL
postgresql.org โบ docs โบ current โบ ecpg-connect.html
PostgreSQL: Documentation: 18: 34.2. Managing Database Connections
May 14, 2026 - The connection target DEFAULT initiates a connection to the default database under the default user name.