Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pgAdmin3 connection problems

I'm recently setting up and running a Windows 2008 r2 server with VMware Workstation 8.

I'm running a Centos 6.2 virtual linux box with Postgresql 9.1. Everything seems ok locally and I can connect to the CentOS box via a bridged network connection.

I have followed David Ghedini's walkthrough for setting up Postgresql 9.1. So I am able to start a putty session window, log in as root and start psql shell and issue statements as postgres user. My problem is that I cannot connect using pgAdmin III from my Windows 7 client. I have updated the /var/lib/pgsql/9.1/data/postgresql.conf to enable listen_addresses '*', etc.

Could anyone give me any tips on finding my fault. Have ensured Windows Firewall is disabled on the Windows server, too.

The pgAdmin III client reports;

'Server doesn't listen'

The server doesn't accept connections: the connection library reports

could not connect to server: Connection timed out (0x0000274C/10060) Is the server running on host "192.168.1.26" and accepting TCP/IP connections on port 5432?

This is the pg_hba.conf file entry added:

#TYPE DATABASE   USER   ADDRESS          METHOD
host  all        all    192.168.1.0/24   trust

And the iptables file entries added:

-A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 192.168.1.26 --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -s 192.168.1.26 --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
like image 610
Jez Avatar asked Jun 23 '12 17:06

Jez


People also ask

How do I connect to a server on pgadmin3?

Connecting to a Database with pgAdmin III After running OpenVPN as administrator and establishing a connection you should also run pgAdmin III. Establish a new connection from File -> Add Server… menu (the first icon in the toolbar). Enter the details to connect to the database in the New Server Registration window.

Why is pgAdmin not connecting to server?

If pgAdmin displays this message, there are two possible reasons for this: the database server isn't running - simply start it. the server isn't configured to accept TCP/IP requests on the address shown.

Can't connect to postgres server?

“Could not connect to server: Connection refused” To be sure that PostgreSQL is running, you can also restart it with systemctl restart postgresql. If this does not fix the problem, the most likely cause of this error is that PostgreSQL is not configured to allow TCP/IP connections.

How do I make a pgadmin3 server?

Using a GUI Run pgAdmin. Right-click on the item Servers , select Create -> Server and provide the connection to your PostgreSQL instance set up in step 1. In the default PostgreSQL setup, the administrator user is postgres with an empty password. In the connection tab be sure to have the host set to localhost .


2 Answers

You need to adjust pg_hba.conf:

http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html

Once you add your own host and corresponding user, restart postgresql server so hopefully you can connect.

Also you might need to enable it's port on the network: http://www.cyberciti.biz/tips/postgres-allow-remote-access-tcp-connection.html

like image 60
Andrew Avatar answered Oct 07 '22 21:10

Andrew


i have the same problem. I disabled all my third party antiviruses and firewalls and reinstall PostgreSQL again and its now working fine... :)

like image 38
jeswin Avatar answered Oct 07 '22 22:10

jeswin