Подобная ошибка возникает, если доступ к серверу ограничен файерволом или PostgreSQL не принимает подключение по указанному адресу/порту (10.0.2.15). Настройка файервола выходит за рамки тематики данного сайта, поэтому ниже приводится только решение проблемы, связанной с настройкой PostgreSQL.
Содержание
- Решение¶
- Responses
- Browse pgsql-general by date
Решение¶
Необходимо зайти на сервер по ssh и проверить статус СУБД командой:
Pезультат выполнения команды означает, что PostgreSQL принимает подключения по адресу 127.0.0.1 и порту 5432. Чтобы изменить настройки, понадобится отредактировать файл postgresql.conf
Найти местонахождение файла можно командой:
Надо указать PostgreSQL, что необходимо принимать подключения по всем адресам:
и перезагрузить СУБД:
Теперь необходимо проверить настройки:
Теперь доступ к базе данных есть с любого адреса. Можно попытаться подключиться к базе данных:
Если сервер доступен, то будет получен доступ к базе данных postgres:
I have installed PostgreSQL. However everytime I try to connect through PGAdmin or through psql it gives me the below error.
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host «localhost» (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host «localhost» (127.0.0.1) and accepting TCP/IP connections on port 5432?
I have checked the postgresql.conf file and listen_addresses = ‘*’ is not commented out.
Also this is what my pg_hba.conf.txt file is set to
Can anyone please advise on how I can resolve this issue?
Good morning to everybody
I have a pg9 db to wich i can connect to by local but not from remote. In the properties of the postgres db , the port is set to 5300 (not the default 5432).
I tried to connect in remote with pgadmin3 and quantum gis, both give the error Connection refused (0x0000274D/10061).
This is the complet message in quantum gis (but is silimar in pgadmin3)
«could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host «95.110.201.74» and accepting
TCP/IP connections on port 5300?»
Whit both the programs installed on the same pc of the db, i can connect without problem to the db.
I already did these settings:
— in postgresql.conf : listen_addresses = ‘*’ and port = 5300 (in the place of the default 5432)
host [dbname] all 0.0.0.0/0 md5
host [dbname] all 127.0.0.1/32 md5
I also tried to substitute on the db properties «host=localhost» with «host=95.110.201.74»
On the machines are not active firewalls.
Have you any clue of what’s wrong?
Responses
- Re: Connection refused (0x0000274D/10061) at 2011-09-30 13:46:48 from Adrian Klaver
- Re: Connection refused (0x0000274D/10061) at 2011-09-30 23:31:08 from Craig Ringer
Browse pgsql-general by date
Copyright © 1996-2019 The PostgreSQL Global Development Group
Источник: