Error Cannot Connect To The Postgresql Server
Contents |
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About unable to connect to postgresql server Us Learn more about Stack Overflow the company Business Learn more about hiring
Unable To Connect To Postgresql Server Fatal Ident Authentication Failed For User
developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is
Unable To Connect To Postgresql Server Remotely
a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how
Postgresql Server Closed The Connection Unexpectedly
it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top can't connect to remote postgresql database up vote 6 down vote favorite 1 I'm trying to connect to a remote psql database. Before I added the pg_hba.conf entry with the client's IP address, I was getting an error message : xdev@xdevbox:~$ psql -U postgres testdb -h postgresql server ubuntu 10.1.1.47 psql: FATAL: no pg_hba.conf entry for host "10.201.50.71", user "postgres", database "testdb", SSL off I added the client's IP with trust settings. I also changed the listen address in postgres.conf on the server to listen to "*". Then I restarted the database server using /etc/init.d/postgresql restart command. Now when I try to connect, I get the following error message: psql: could not connect to server: Connection refused Is the server running on host "10.1.1.47" and accepting TCP/IP connections on port 5432? in postgresql.conf, the port is set to 5432. I'm not sure what else to check. Thanks postgresql remote share|improve this question asked May 4 '15 at 17:45 dot 271312 Can you ping that address? –dezso May 4 '15 at 19:44 1 I'd say the DB didn't restart correctly when you restarted it. Check the PostgreSQL log files for the reason why - probably a typo in pg_hba.conf. –Craig Ringer May 5 '15 at 5:03 I had to change the listen address from * to the specific ip address. –dot May 5 '15 at 13:29 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted You have to configure
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more postgresql server download about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users postgresql server mac Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping postgresql sql server each other. Join them; it only takes a minute: Sign up Why psql can't connect to server? up vote 1 down vote favorite I typed psql and I get this: psql: could not connect to server: No such http://dba.stackexchange.com/questions/100564/cant-connect-to-remote-postgresql-database file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? I used sudo netstat -nlp | grep 5432 to see the status but nothing showed. And I searched online, somebody told me to modify pg_hba.conf but I can't locate this file. And I also tried this commandsudo ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432. It can't work. postgresql psql share|improve this question asked Jul 27 '15 at 5:31 deathlee 509414 add a comment| 2 http://stackoverflow.com/questions/31645550/why-psql-cant-connect-to-server Answers 2 active oldest votes up vote 3 down vote accepted The error states that the psql utility can't find the socket to connect to your database server. Either you don't have the database service running in the background, or the socket is located elsewhere, or perhaps the pg_hba.conf needs to be fixed. Step 1: Verify that the database is running The command may vary depending on your operating system. But on most *ix systems the following would work, it will search for postgres among all running processes ps -ef | grep postgres On my system, mac osx, this spits out 501 408 1 0 2Jul15 ?? 0:21.63 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log The last column shows the command used to start the server, and the options. You can look at all the options available to start the postgres server using the following. man postgres From there, you'd see that the options -D and -r are respectively the datadir & the logfilename. Step 2: If the postgres service is running Use find to search for the location of the socket, which should be somewhere in the /tmp sudo find /tmp/ -name .s.PGSQL.5432 If postgres is running and accepting socket connections, the above should tell you the location of the socket. On my machine, it turned out to be: /tmp/.s.PGSQL.5432 Then, try connecting via psql using this file's
2007 in Debian / Ubuntu, Linux, Networking, PostgreSQL, RedHat and Friends, UNIXQ. When I try to connect remote PostgreSQL, I am reciving http://www.cyberciti.biz/faq/postgresql-remote-access-or-connection/ an error which read as follows:
psql: could not connect to server: Connection refused Is the server running on host host.domain.com and accepting TCP/IP connections on port 5432? How do I fix this problem? I am using CentOS 4.x version.A. First make sure PostgreSQL server has been started to remote server.# /etc/init.d/postgresql startIf sql server it is running and you get above error, you need to add enable TCP/IP support. By default, the PostgreSQL server only allows connections to the database from the local machine or localhost. This is a security feature.Step # 1: Allow remote IP address to access PostgreSQLYou need to open file called /var/lib/pgsql/data/pg_hba.conf. Login unable to connect as postgres user using su command: $ su - postgres$ vi /var/lib/pgsql/data/pg_hba.conf
Now append following line. Let us say you would like to give access to 192.168.1.0/24 network: host all all 192.168.1.0 255.255.255.0 trust Please replace 192.168.1.0 and 255.255.255.0 to reflect the actual network IP address range of the clients system in your own network.Save close the file.Step # 2: Allow communication over TCP/IPYou need to open PostgreSQL configuration file /var/lib/pgsql/data/postgresql.conf $ vi /var/lib/pgsql/data/postgresql.conf Now bind and open TCP/IP port by setting tcpip_socket to true: tcpip_socket = trueSave and close the file.Step # 3: Restart PostgreSQL serverRestart the PostgreSQL server with the following command # /etc/init.d/postgresql restartThis will open default port 5432.Step # 4: Test your setupUse psql command from client system as follows: psql -h PostgreSQL-IP-ADDRESS -U USERNAME -d DATABASENAMEConnect to remote server by IP address 192.168.1.5 and login using vivek user to connect to sales database, use: $ psql -h 192.168.1.5 -U v