postgres connection refused in ubuntu

1

getting an error while connecting remotely and the error says something like

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

please help me out

linux
networking
ubuntu
service
database-connection
asked on Stack Overflow Mar 7, 2013 by user2144172 • edited Dec 6, 2013 by Chris Travers

1 Answer

1

Open your terminal and write

service postgresql status

If it says it is not running than write

service postgresql start

If the service is already running then check the listening port of your postgresql service via

netstat -an | grep postgresql

and the result will show the port it is listening.And then you can connect your database with the command

psql -h localhost -p port_you_found -U postgres
answered on Stack Overflow Mar 11, 2013 by talipkorkmaz • edited Dec 22, 2020 by Daniel Böhmer

User contributions licensed under CC BY-SA 3.0