[英]can't connect to postgres on windows10
I am setting up project on my windows PC and I have a problem with postgres. 我正在我的Windows PC上设置项目,我遇到了postgres的问题。 Project is set on docker.
项目设置在docker上。 when I run
docker-compose up
I receive error 当我运行
docker-compose up
我收到错误
: *** Failed to connect to database dev; trying to create database
/usr/local/bundle/gems/sequel-4.48.0/lib/sequel/adapters/postgres.rb:224:in `initialize': PG::ConnectionBad: could not connect to server: Connection refused (Sequel::DatabaseConnectionError)
Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?
I don't know what to do. 我不知道该怎么办。 I have already installed microsoft easy-fix for TCP-IP, shut down windows firewall, changed all connection in
pg_hba.conf
to trust. 我已经为TCP-IP安装了microsoft easy-fix,关闭了windows防火墙,将
pg_hba.conf
所有连接都更改为信任。 Nothing helps. 什么都没有帮助。 I don't have any antivirus software installed.
我没有安装任何防病毒软件。
nmap report: nmap报告:
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0027s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 995 closed ports
PORT STATE SERVICE
135/tcp open msrpc
445/tcp open microsoft-ds
2068/tcp open avocentkvm
2179/tcp open vmrdp
5432/tcp open postgresql
edit: I run psql -h localhost
and received 编辑:我运行
psql -h localhost
并收到
psql: CATASTROPHIC: role "Kamil" does not exist
Kamil is my PC name. 卡米尔是我的电脑名称。
is it possible that docker doesn't have access to postgres on localhost? 是否有可能docker无法访问localhost上的postgres?
I had to set environment var to DB_HOST=docker.for.win.localhost
我必须将环境var设置为
DB_HOST=docker.for.win.localhost
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.