Problemas com conexao PostgreSQL

8 respostas
EuclidesFilizola

Boa Tarde a todos. estou P***** com o postgre. Toda vez agora, eu tenho que reinstalar pra ele funcionar. Quando eu desligo a maquina e no outro dia eu ligo. Não funciona mais. ele da o seguinte erro :

Server doesn’t listen
The server doesn’t accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host “127.0.0.1” and accepting TCP/IP connections on port 5432?
If you encounter this message, please check if the server you’re trying to contact is actually running PostgreSQL on the given port. Test if you have network connectivity from your client to the server host using ping or equivalent tools. Is your network / VPN / SSH tunnel / firewall configured correctly?
For security reasons, PostgreSQL does not listen on all available IP addresses on the server machine initially. In order to access the server over the network, you need to enable listening on the address first.
For PostgreSQL servers starting with version 8.0, this is controlled using the “listen_addresses” parameter in the postgresql.conf file. Here, you can enter a list of IP addresses the server should listen on, or simply use ‘*’ to listen on all available IP addresses. For earlier servers (Version 7.3 or 7.4), you’ll need to set the “tcpip_socket” parameter to ‘true’.
You can use the postgresql.conf editor that is built into pgAdmin III to edit the postgresql.conf configuration file. After changing this file, you need to restart the server process to make the setting effective.
If you double-checked your configuration but still get this error message, it’s still unlikely that you encounter a fatal PostgreSQL misbehaviour. You probably have some low level network connectivity problems (e.g. firewall configuration). Please check this thoroughly before reporting a bug to the PostgreSQL community.

… ou seja… como se não tivesse aceitando a conexão com o banco. Já TENTEI de QUASE TUDO. que pudesse ser feito, reiniciar o serviço, alterar banco. criar outro banco, testar o outro ou outros usuarios … ETC… mas P**** nenhuma deu certo ! … Alguém pode me ajudar ??? vou me matar com isso… ¬¬

agradeço a atenção de todos !

8 Respostas

eduardoromcy

Amigo, você está definindo os acessos no arquivo pg_hba.conf.

EuclidesFilizola

meu pg_hba.conf

ta assim

TYPE DATABASE USER CIDR-ADDRESS METHOD

IPv4 local connections:

host all all 127.0.0.1/32 md5

IPv6 local connections:

#host all all ::1/128 md5

… preciso de algo mais ?

eduardoromcy

Eu faço assim e fica beleza, recomendo que tente:

TYPE DATABASE USER CIDR-ADDRESS METHOD

IPv4 local connections:

host all all 127.0.0.1/32 md5
host all all 172.24.0.0/16 trust - minha faixa de IP
host all all localhost trust - para conectar localmente

IPv6 local connections:

host all all ::1/128 md5

Tenho quase certeza que dará certo, testa e me informa.

eduardoromcy

Outro detalhe, quando vc modifica o pg_hba.conf você deve parar o banco e restart para as alterações entrarem em vigor.

Abraço.

EuclidesFilizola

não funfou :frowning:

EuclidesFilizola

nessa parte… " minha faixa de IP " … eu coloco oq ?? 192.168.0.254 ?

eduardoromcy

Se esse é seu IP, vc coloca 192.168.0.0/16.
Tenta criar outra linha so com seu IP, assim 192.168.0.254, sem o barra 16, com final “trust” e lembra de reiniciar o banco, ou reinicia o micro.

eduardoromcy

Para evitar possivel erro na compreensão, faça o seu igual a esse aqui:

IPv4 local connections:

host all all 127.0.0.1/32 md5
host all all 192.168.0.0/16 trust
host all all localhost trust
host all all 192.168.0.254 trust

IPv6 local connections:

host all all ::1/128 md5

Testa e me fala.

Criado 3 de março de 2009
Ultima resposta 3 de mar. de 2009
Respostas 8
Participantes 2