# Database connection error when setting up Discourse development environment using Linux Bash Shell on Windows 10

**URL:** https://meta.discourse.org/t/database-connection-error-when-setting-up-discourse-development-environment-using-linux-bash-shell-on-windows-10/86509
**Category:** Development
**Created:** [April 30, 2018, 5:40am UTC](https://meta.discourse.org/t/database-connection-error-when-setting-up-discourse-development-environment-using-linux-bash-shell-on-windows-10/86509 "2018-04-30T05:40:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![utsav\_lamichane](https://avatars.discourse-cdn.com/v4/letter/u/bcef8e/32.png) [@utsav\_lamichane](https://meta.discourse.org/u/utsav_lamichane)
#### Post date: [April 30, 2018, 5:40am UTC](https://meta.discourse.org/t/database-connection-error-when-setting-up-discourse-development-environment-using-linux-bash-shell-on-windows-10/86509/1 "2018-04-30T05:40:30Z")

</div>

(error on this command)

 ![pro](https://global.discourse-cdn.com/meta/original/3X/0/3/032eff3712756ce38cf6357b7080dc3523b581b0.jpg)

bundle exec rake db:migrate db:test:prepare db:seed\_fu

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [April 30, 2018, 3:57pm UTC](https://meta.discourse.org/t/database-connection-error-when-setting-up-discourse-development-environment-using-linux-bash-shell-on-windows-10/86509/2 "2018-04-30T15:57:54Z")

</div>

Based on the error message

> PG::ConnectionBad: could not connect to server

I would double check that psql is installed and running

---

<div class="post-metadata">

### Author: ![utsav\_lamichane](https://avatars.discourse-cdn.com/v4/letter/u/bcef8e/32.png) [@utsav\_lamichane](https://meta.discourse.org/u/utsav_lamichane)
#### Post date: [May 1, 2018, 5:23am UTC](https://meta.discourse.org/t/database-connection-error-when-setting-up-discourse-development-environment-using-linux-bash-shell-on-windows-10/86509/3 "2018-05-01T05:23:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [May 1, 2018, 6:52am UTC](https://meta.discourse.org/t/database-connection-error-when-setting-up-discourse-development-environment-using-linux-bash-shell-on-windows-10/86509/4 "2018-05-01T06:52:25Z")

</div>

> [@utsav\_lamichane](#):
>
> The powershell is showing the port active. But, inactive in UBUNTU for windows terminal

Did you followed [this guide](https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-windows-10-for-development/75149)? Where your Postgres is running. In “Windows” or “Ubuntu for Windows”?

---

<div class="post-metadata">

### Author: ![DiscoStew](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discostew/32/124664_2.png) [@DiscoStew](https://meta.discourse.org/u/DiscoStew)
#### Post date: [November 14, 2018, 6:32am UTC](https://meta.discourse.org/t/database-connection-error-when-setting-up-discourse-development-environment-using-linux-bash-shell-on-windows-10/86509/5 "2018-11-14T06:32:28Z")

</div>

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.
