# Trouble conecting RulesEngine to MySql

**URL:** <https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775>\
**Category:** Troubleshooting\
**Tags:** boron\
**Created:** [August 20, 2019, 1:21pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775 "2019-08-20T13:21:03Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 20, 2019, 1:21pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/1 "2019-08-20T13:21:03Z")

</div>

Hello everyone.  
I am working on a project for my company, and am publishing downtimes from machines to a dashboard hosted in node red(particle RulesEngine). This works so far.  
I also created a MySql database, but the problem is it does not connect. I get this error log: “Error: connect ECONNREFUSED 127.0.0.1:3306”.  
I am Running the database on localhost.

Any suggestions why this could be happening?

---

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 20, 2019, 1:23pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/2 "2019-08-20T13:23:28Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/9/2/926cb0aa2333a36e4ad380b0ddb8c7e3a459d696.png)  
this is my flow

---

<div class="post-metadata">

**Author:** ![picsil](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/picsil/32/21737_2.png) [@picsil](https://community.particle.io/u/picsil)\
**Post date:** [August 20, 2019, 1:32pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/3 "2019-08-20T13:32:07Z")

</div>

Connection refused indicates MySQL is not started, is not listening on 127.0.0.1, or a host-based firewall is blocking the connection. Not a nodeRed issue.

---

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 20, 2019, 1:35pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/4 "2019-08-20T13:35:09Z")

</div>

Thank you very much!

---

<div class="post-metadata">

**Author:** ![shanevanj](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/shanevanj/32/21186_2.png) [@shanevanj](https://community.particle.io/u/shanevanj)\
**Post date:** [August 21, 2019, 8:48am UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/5 "2019-08-21T08:48:55Z")

</div>

I would try to connect to the MySql from the command line or from MySql workbench to validate its up.

---

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 22, 2019, 2:07pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/6 "2019-08-22T14:07:28Z")

</div>

I tried using the workbench, and was succesfull to connect to the server, but not with the rules engine.

---

<div class="post-metadata">

**Author:** ![picsil](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/picsil/32/21737_2.png) [@picsil](https://community.particle.io/u/picsil)\
**Post date:** [August 22, 2019, 3:19pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/7 "2019-08-22T15:19:26Z")

</div>

Is rules engine running on the same host as mysql?

---

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 23, 2019, 7:23am UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/8 "2019-08-23T07:23:39Z")

</div>

Hi @picsil, thanks for your reply. How can I make sure that both are running on the same host? In case they aren´t, how do I handle this issue?

---

<div class="post-metadata">

**Author:** ![picsil](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/picsil/32/21737_2.png) [@picsil](https://community.particle.io/u/picsil)\
**Post date:** [August 23, 2019, 12:20pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/9 "2019-08-23T12:20:03Z")

</div>

I was asking if both applications are installed on the same machine because you’re using IP address 127.0.0.1, which is only accessible on the local machine. 127.0.0.1 is the loopback address, which connects back to itself. Works fine for applications installed on one machine, but if your rules engine is on another machine, you’ll need to use the real IP of your mysql host, not 127.0.0.1.

---

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 23, 2019, 12:46pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/10 "2019-08-23T12:46:24Z")

</div>

Yes, for testing purposes I am running both instances on the same machine.

---

<div class="post-metadata">

**Author:** ![picsil](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/picsil/32/21737_2.png) [@picsil](https://community.particle.io/u/picsil)\
**Post date:** [August 23, 2019, 10:06pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/11 "2019-08-23T22:06:32Z")

</div>

What OS are you running on the server? Can you show the output of the following commands?

Linux:

```auto
netstat -anp

```

Mac or Windows:

```auto
netstat -an

```

---

<div class="post-metadata">

**Author:** ![gusgonnet](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/gusgonnet/32/27491_2.png) [@gusgonnet](https://community.particle.io/u/gusgonnet)\
**Post date:** [August 24, 2019, 12:58am UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/12 "2019-08-24T00:58:34Z")

</div>

> [@picsil](#):
>
> ```auto
> netstat -anp
> 
> ```

I'm with you. I was also wondering about the output of

> netstat -na | grep 3306

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [August 24, 2019, 1:38am UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/13 "2019-08-24T01:38:58Z")

</div>

Just to be a 100%. You mention mSQL and the rules engine on the same machine:

> [@koenent](#):
>
> Yes, for testing purposes I am running both instances on the same machine.

But you also specifically refer to it as the Particle Rules Engine.

> [@koenent](#):
>
> a dashboard hosted in node red(particle RulesEngine)

Are you using the Particle hosted non-public Rules engine, or are you using a self-hosted version of node-red with community nodes for Particle functionality?

---

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 26, 2019, 7:05am UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/14 "2019-08-26T07:05:41Z")

</div>

@Moors7 To be honest, I am not sure, my company has a contract with Particle, and they set up the devices and gave us the accounts. I would have to ask.

---

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 26, 2019, 7:08am UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/15 "2019-08-26T07:08:20Z")

</div>

@picsil This is the Ouput of the command ( I am using Windows 10):

Aktive Verbindungen

Proto Lokale Adresse Remoteadresse Status  
TCP 0.0.0.0:135 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:445 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:3389 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:4343 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:5357 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:8081 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:9535 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:9593 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:9594 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:9595 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:9999 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:33354 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:47546 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49664 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49665 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49666 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49667 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49668 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49670 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49673 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49675 0.0.0.0:0 ABHÖREN  
TCP 0.0.0.0:49706 0.0.0.0:0 ABHÖREN  
TCP 10.226.142.55:139 0.0.0.0:0 ABHÖREN  
TCP 10.226.142.55:51960 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:52001 199.19.250.205:80 FIN\_WARTEN\_2  
TCP 10.226.142.55:52078 199.19.250.205:80 FIN\_WARTEN\_2  
TCP 10.226.142.55:64221 10.179.140.252:445 HERGESTELLT  
TCP 10.226.142.55:64242 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64275 52.112.194.49:443 HERGESTELLT  
TCP 10.226.142.55:64323 10.200.200.133:445 HERGESTELLT  
TCP 10.226.142.55:64328 10.200.231.79:445 HERGESTELLT  
TCP 10.226.142.55:64435 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64449 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64463 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64465 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64481 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64699 199.19.250.205:80 SCHLIESSEN\_WARTEN  
TCP 10.226.142.55:64700 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64702 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64715 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64721 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64722 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64724 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64725 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64731 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64755 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64756 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64759 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64762 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64784 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64798 10.179.168.123:443 HERGESTELLT  
TCP 10.226.142.55:64824 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64827 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64830 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64833 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64836 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64841 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64843 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64844 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64845 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64846 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64848 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64849 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64851 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64868 199.19.250.205:80 WARTEND  
TCP 10.226.142.55:64869 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64874 10.179.168.123:443 WARTEND  
TCP 10.226.142.55:64875 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64878 10.179.168.123:443 WARTEND  
TCP 10.226.142.55:64880 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64881 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64882 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64883 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64885 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64887 52.139.250.253:443 SYN\_GESENDET  
TCP 10.226.142.55:64888 64.233.189.108:993 SYN\_GESENDET  
TCP 10.226.142.55:64889 52.229.171.202:443 SYN\_GESENDET  
TCP 10.226.142.55:64890 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64891 199.19.250.205:80 HERGESTELLT  
TCP 10.226.142.55:64892 199.19.250.205:80 HERGESTELLT  
TCP 127.0.0.1:9535 127.0.0.1:63422 HERGESTELLT  
TCP 127.0.0.1:9592 0.0.0.0:0 ABHÖREN  
TCP 127.0.0.1:9592 127.0.0.1:64797 HERGESTELLT  
TCP 127.0.0.1:9595 127.0.0.1:64828 WARTEND  
TCP 127.0.0.1:21584 0.0.0.0:0 ABHÖREN  
TCP 127.0.0.1:21584 127.0.0.1:64858 WARTEND  
TCP 127.0.0.1:21584 127.0.0.1:64860 WARTEND  
TCP 127.0.0.1:21584 127.0.0.1:64862 WARTEND  
TCP 127.0.0.1:21584 127.0.0.1:64864 WARTEND  
TCP 127.0.0.1:21584 127.0.0.1:64866 WARTEND  
TCP 127.0.0.1:27017 0.0.0.0:0 ABHÖREN  
TCP 127.0.0.1:49671 0.0.0.0:0 ABHÖREN  
TCP 127.0.0.1:49671 127.0.0.1:49674 HERGESTELLT  
TCP 127.0.0.1:49674 127.0.0.1:49671 HERGESTELLT  
TCP 127.0.0.1:49704 0.0.0.0:0 ABHÖREN  
TCP 127.0.0.1:51205 127.0.0.1:64863 WARTEND  
TCP 127.0.0.1:51207 127.0.0.1:64867 WARTEND  
TCP 127.0.0.1:51214 127.0.0.1:64865 WARTEND  
TCP 127.0.0.1:51235 127.0.0.1:64856 WARTEND  
TCP 127.0.0.1:62522 0.0.0.0:0 ABHÖREN  
TCP 127.0.0.1:63422 127.0.0.1:9535 HERGESTELLT  
TCP 127.0.0.1:64797 127.0.0.1:9592 HERGESTELLT  
TCP 127.0.0.1:64857 127.0.0.1:21584 WARTEND  
TCP 127.0.0.1:64870 127.0.0.1:9592 WARTEND  
TCP 127.0.0.1:64877 127.0.0.1:9592 WARTEND  
TCP 192.168.18.1:139 0.0.0.0:0 ABHÖREN  
TCP 192.168.22.1:139 0.0.0.0:0 ABHÖREN  
TCP [::]:135 [::]:0 ABHÖREN  
TCP [::]:445 [::]:0 ABHÖREN  
TCP [::]:3389 [::]:0 ABHÖREN  
TCP [::]:5357 [::]:0 ABHÖREN  
TCP [::]:8081 [::]:0 ABHÖREN  
TCP [::]:9535 [::]:0 ABHÖREN  
TCP [::]:9593 [::]:0 ABHÖREN  
TCP [::]:9594 [::]:0 ABHÖREN  
TCP [::]:9595 [::]:0 ABHÖREN  
TCP [::]:9999 [::]:0 ABHÖREN  
TCP [::]:47546 [::]:0 ABHÖREN  
TCP [::]:49664 [::]:0 ABHÖREN  
TCP [::]:49665 [::]:0 ABHÖREN  
TCP [::]:49666 [::]:0 ABHÖREN  
TCP [::]:49667 [::]:0 ABHÖREN  
TCP [::]:49668 [::]:0 ABHÖREN  
TCP [::]:49670 [::]:0 ABHÖREN  
TCP [::]:49673 [::]:0 ABHÖREN  
TCP [::]:49675 [::]:0 ABHÖREN  
TCP [::]:49706 [::]:0 ABHÖREN  
TCP [::1]:7821 [::]:0 ABHÖREN  
UDP 0.0.0.0:123 _:_  
UDP 0.0.0.0:500 _:_  
UDP 0.0.0.0:3389 _:_  
UDP 0.0.0.0:3702 _:_  
UDP 0.0.0.0:3702 _:_  
UDP 0.0.0.0:4500 _:_  
UDP 0.0.0.0:5050 _:_  
UDP 0.0.0.0:5353 _:_  
UDP 0.0.0.0:5353 _:_  
UDP 0.0.0.0:5353 _:_  
UDP 0.0.0.0:5353 _:_  
UDP 0.0.0.0:5355 _:_  
UDP 0.0.0.0:9595 _:_  
UDP 0.0.0.0:33354 _:_  
UDP 0.0.0.0:33355 _:_  
UDP 0.0.0.0:38293 _:_  
UDP 0.0.0.0:49544 _:_  
UDP 0.0.0.0:52787 _:_  
UDP 10.226.142.55:137 _:_  
UDP 10.226.142.55:138 _:_  
UDP 10.226.142.55:1900 _:_  
UDP 10.226.142.55:57548 _:_  
UDP 10.226.142.55:63950 _:_  
UDP 127.0.0.1:1900 _:_  
UDP 127.0.0.1:50112 _:_  
UDP 127.0.0.1:53655 _:_  
UDP 127.0.0.1:57061 _:_  
UDP 127.0.0.1:57549 _:_  
UDP 127.0.0.1:60335 _:_  
UDP 127.0.0.1:61765 _:_  
UDP 127.0.0.1:62309 _:_  
UDP 192.168.18.1:137 _:_  
UDP 192.168.18.1:138 _:_  
UDP 192.168.18.1:1900 _:_  
UDP 192.168.18.1:49512 _:_  
UDP 192.168.18.1:57546 _:_  
UDP 192.168.22.1:137 _:_  
UDP 192.168.22.1:138 _:_  
UDP 192.168.22.1:1900 _:_  
UDP 192.168.22.1:57547 _:_  
UDP 192.168.22.1:60418 _:_  
UDP [::]:123 _:_  
UDP [::]:500 _:_  
UDP [::]:3389 _:_  
UDP [::]:3702 _:_  
UDP [::]:3702 _:_  
UDP [::]:4500 _:_  
UDP [::]:49544 _:_  
UDP [::]:52788 _:_  
UDP [::1]:1900 _:_  
UDP [::1]:57545 _:_

C:\WINDOWS\system32\>

---

<div class="post-metadata">

**Author:** ![picsil](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/picsil/32/21737_2.png) [@picsil](https://community.particle.io/u/picsil)\
**Post date:** [August 28, 2019, 9:47pm UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/16 "2019-08-28T21:47:43Z")

</div>

Sorry for the late reply. I’ve been out of town. I don’t see anything listening on port 3306, which is the typical port used by MySQL. That implies that either a) MySQL is installed on the machine but not running; b) MySQL is installed on a different machine than the one you ran the command on; or c) MySQL is listening on a port other than 3306.

This looks like an issue related to MySQL, not anything Particle related. You may find more helpful answers on a MySQL forum.

---

<div class="post-metadata">

**Author:** ![koenent](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/koenent/32/22249_2.png) [@koenent](https://community.particle.io/u/koenent)\
**Post date:** [August 29, 2019, 7:22am UTC](https://community.particle.io/t/trouble-conecting-rulesengine-to-mysql/51775/17 "2019-08-29T07:22:09Z")

</div>

Thanks for your answer!
