# Postgresql with nodered - Error: connect ECONNREFUSED 192.168.0.27:5432

**URL:** <https://discourse.nodered.org/t/postgresql-with-nodered-error-connect-econnrefused-192-168-0-27-5432/59408>\
**Category:** Developing Nodes\
**Tags:** database\
**Created:** [5 March 2022 18:34 UTC](https://discourse.nodered.org/t/postgresql-with-nodered-error-connect-econnrefused-192-168-0-27-5432/59408 "2022-03-05T18:34:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![retegi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/retegi/32/62526_2.png) [@retegi](https://discourse.nodered.org/u/retegi)\
**Post date:** [5 March 2022 18:34 UTC](https://discourse.nodered.org/t/postgresql-with-nodered-error-connect-econnrefused-192-168-0-27-5432/59408/1 "2022-03-05T18:34:46Z")

</div>

Hi!  
I am trying to connect PostgreSQL with nodered, but:  
Error: connect ECONNREFUSED 192.168.0.27:5432

Nodered is inside a virtual machine (ip: 192.168.0.28)

PostgreSQL isinside virtual machine (192.168.0.27)  
db\_instalacion  
user\_instalacion  
port:5432

Between the virtual machines the communication is correct, since I can ping without problem

What is happening?

Thanks

 ![conf1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/379d022efd064261216d1aff94f058f9b16c589b.png)  
 ![conf2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/4051c1cdb966bd035c903452c1097e42aa09e21b.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 March 2022 20:31 UTC](https://discourse.nodered.org/t/postgresql-with-nodered-error-connect-econnrefused-192-168-0-27-5432/59408/2 "2022-03-05T20:31:13Z")

</div>

Have you etup PostgreSQL to allow Remote Connections?

Tons of info on the net e.g. "How To Configure PostgreSQL to Allow Remote Connections – TecAdmin" [How To Configure PostgreSQL to Allow Remote Connections – TecAdmin](https://tecadmin.net/postgresql-allow-remote-connections/?amp)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 March 2022 20:39 UTC](https://discourse.nodered.org/t/postgresql-with-nodered-error-connect-econnrefused-192-168-0-27-5432/59408/3 "2022-03-05T20:39:23Z")

</div>

Also check (from the node-red machine) that port 5432 is open on the db machine. Using nmap for example.

---

<div class="post-metadata">

**Author:** ![retegi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/retegi/32/62526_2.png) [@retegi](https://discourse.nodered.org/u/retegi)\
**Post date:** [6 March 2022 14:48 UTC](https://discourse.nodered.org/t/postgresql-with-nodered-error-connect-econnrefused-192-168-0-27-5432/59408/4 "2022-03-06T14:48:40Z")

</div>

Thanks! I have follow link steps. In the first time i had a problem because i couldn´t login in pgadmin after the pg\_hba.conf file change. After i saw a comment thas says: use "host all all ::0/0 md5" and not "host all all :/0 md5" and the connection was ok! Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 May 2022 14:49 UTC](https://discourse.nodered.org/t/postgresql-with-nodered-error-connect-econnrefused-192-168-0-27-5432/59408/5 "2022-05-05T14:49:08Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
