在 Windows 10 上使用 Linux Bash Shell 搭建 Discourse 开发环境时出现数据库连接错误

(error on this command)

bundle exec rake db:migrate db:test:prepare db:seed_fu

Based on the error message

PG::ConnectionBad: could not connect to server

I would double check that psql is installed and running

4 个赞

plsql is installed and database is created as well. I think the problem is on connecting with port 5432. The powershell is showing the port active. But, inactive in UBUNTU for windows terminal

Did you followed this guide? Where your Postgres is running. In “Windows” or “Ubuntu for Windows”?

3 个赞

I was able to figure out a solution to this issue.

When installing postgres, /etc/postgresql/10/main/postgresql.conf contained port=5433. Updating this to port=5432 fixed the issue for me. I ran into this when using Ubuntu on Windows.

Extra Credit:
Running sudo service postgresql status lets you know which port postgres is listening on.

2 个赞