Connect pgAdmin to PostgreSQL - postgresql

I'm trying to connect pgAdmin 4 v4.17 to my PostgreSQL v12.1 that is running on a Debian v9 Stretch server.
I got the error could not connect to server: Connection refused (0x0000274D/10061)
I already tried:
run pgAdmin as admnistrator;
set to listen_addresses = '*' ;
Add the line host all all 0.0.0.0/0 md5;
restarted the server;
Use SSH Tunnel with PuTTY;
Using PuTTY i can access to PostgreSQL normally and execute commands, but pgAdmin doesn't connect, any ideas?
Thanks in advance!

Related

pgAdmin connection to server at "localhost" (::1), port 5432 failed

I'd like to run a postgre db server on localhost:5432. It used to work, then I updated to mac os 13.2. Now if I enter my password to connect to local postgre server, the following error being shown:
Anybody knows how to solve this issue?
I tried to start the postgre sql local server.

connect pgadmin3 to postgres runnng on server

** new to pgadmin and postgress **
my organization uses PostgreSQL on its server with ubuntu os, I try to connect it using pgadmin 3,
these are the stapes I have taken
changed pg_hba.conf using 'sudo nano /etc/postgresql/9.3/main/pg_hba.conf'
changed listen_addresses='*' in postgresql.conf file
sudo ufw allow 5432/tcp
but still, I am unable to connect I get this error from pg admin:
Server doesn't listen
The server doesn't accept connections: the connection library reports could not connect to server: Connection timed out Is the server running on host "103.72.131.155" and accepting TCP/IP connections on port 5432?
how can I fix it,
is there any website which can guide me step by step to connect pgadmin to PostgreSQL.

Postgres remote connection

Hello I have installed PostgresSQL 11 on CentOS Linux release 7.6.1810.
I have edited files pg_hba.conf
host all all all md5
And postgresql.conf
listen_addresses = '*'
However, following a restart I am unable to connect from pgAdmin with error:
could not connect to server: Connection refused (0x0000274D/10061) Is
the server running on host "10.190.9.130" and accepting TCP/IP
connections on port 5432?
If I run Docker container on the same server with postgres it connects successfully. Has anyone had this issue with a manual postgres install?

TCP/IP Connections with Postgres on Virtual Server

I'm trying to connect my local gui for postgres to a virtual server that I have running postgres.
I can
su postgres_user
Then
pgsql
Here pgsql loads.
When I go to my pg_hba.conf I have
host all all x.x.x.x/24 trust
In postgresql.conf
listen_addresses = 'localhost,x.x.x.x'
I have ubuntu 16 and postgres 9.5
I have the issue when I try to connect I get the error:
could not connect to server: Connection refused...Is the server running on host "hostip" and accepting TCP/IP connections on port 5432.
If you are using linode, you must either whitelist your ip or use putty (in windows) to tunnel postgres to connect to it.
putty tunneling is easier, however more annoying to deal with on a day to day basis
Follow the tutorial here.
here
Note, it's the same for PGAdmin as it is for any gui in windows.

PHP can't connect to PostgreSQL on CentOS 7

I have CentOS 7 running in VirtualBox on OSX. Apache, PHP 5.4 and PostgreSQL 9.2 are all running. But, when my (simple) php-script tries to connect to PostgreSQL it doesn't work:
Warning: pg_connect(): Unable to connect to PostgreSQL server: could
not connect to server: Permission denied Is the server running on host
"127.0.0.1" and accepting TCP/IP connections on port 5432? in
/var/www/html/pg.php on line 7
Checks:
Apache is running
PHP is fine, phpinfo() tells me PostgreSQL functions are available
PostgreSQL 9.2 is running
psql can connect to the database using localhost or 127.0.0.1 and also 192.168.178.111
pgAdmin on my Mac can connect to this database using ip address 192.168.178.111
iptables has been turned off
pg_hba.conf has been changed to accept all connections without any password (stupid, I know):
host all all 0.0.0.0/0 trust
But php can't connect....
This is my script:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
echo 'hello world!';
$conn = pg_connect('host=127.0.0.1 port=5432 user=postgres dbname=postgres');
?>
Internal connections work (psql), external connections also work (pgAdmin on a my laptop), but the php connection doesn't work...
What is going wrong? What is it that I'm missing?
Probably SELinux is blocking your database connection.
Make sure that you set the correct boolean to allow your web application to talk to the database:
sudo setsebool -P httpd_can_network_connect_db 1