Answer the question
In order to leave comments, you need to log in
How to connect to PostgreSQL 9.2.18 on a remote CentOS server via SSH?
PostgreSQL 9.2.18 is installed and running on the remote СentOS server. I can connect to the database from my local machine with pgAdmin 3 using SSH. However, when I open an SSH tunnel through Putty (the tunnel is working, the commands in the Putty terminal open after opening the tunnel) and try to open a connection in my PHP application, I get the following error:
Warning: pg_connect(): Unable to connect to PostgreSQL server: expected authentication request from server, but received S
<?php
$db_connection = pg_connect("host=localhost port={локальный SSH порт} dbname={имя дб} user={пользователь дб} password={пароль} sslmode=disable");
?>
Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question