Configuration of Postgresql

Asked

Viewed 464 times

3

I am trying to access my Postgresql database, however I am getting the following error message:

inserir a descrição da imagem aqui

I have a virtual machine Debian 8 with postgresql 9.4 installed and I am trying to access via my Windows 7.

I made changes in my files pg_hba.conf and postgresql.conf, but to no avail.

# Database administrative login by UNIX sockets
local   all         postgres                          ident sameuser

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
host    all        all         192.168.0.0/24         md5

local   all         all                               ident sameuser
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

Does anyone have any idea what it might be? Thanks in advance.

  • Try adding the following line: host all all 0.0.0.0/0 trust and restart Postgresql

  • Hello, I changed the line but still gives the error. This line would free access for all accesses, correct? Could it be some kind of door lock 5432? Or it has nothing to do?

  • Maybe so, but is the door really open? This command lists the open doors: netstat -nl

  • @Luídne gave the command and the door 5432 did not appear in the list, as I do to open?

  • The service may not be running. Check using the command service postgres status and if you are not running use the command service postgres start and check the door again.

  • Try to rotate the nmap from Windows to see if your virtual machine is exposing port 5432 - you probably need to open the port to be able to access Postgresql from Windows (how to do this depends on the virtualization program: Vmware, Virtualbox, ...).

  • @Luídne, I was able to make it work, when you told me to check the service postgres status, I realized it was deactivated. I uninstalled the postgre and installed it again in the hope of starting all over again and working out, and with that I saw that door 5432 was open with the newly installed postgre. When messing with the configuration of pg_hba.conf I realized that the door stopped appearing in netstat. Then I discovered that the error was actually in the file that made the door disappear. With the line host all all 192.168.0.0/0 trust I managed to make it work. Thank you!

Show 2 more comments

1 answer

1


With Luídne’s help I discovered that my file pg_hba.conf was making the door 5432 postgre not open when giving the command netstat -nl.

I reinstalled postgresql in my debian and gave the netstat command. Thus port 5432 was open with postgresql in the default settings. When editing the file pg_hba.conf again I realized that the door stopped being open, it leads me to believe that it may be that I had some error in the file.

With the file pg_hba.conf this way, everything worked normally:

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
host    all             all             192.168.0.0/0           trust
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5

Browser other questions tagged

You are not signed in. Login or sign up in order to post.