Mysql connection refused

Hi there, I've seen that some similar questions have already been replied but didn't seem to clarify my actual problem. The situation so far:

  • We have installed an IOT on our system to monitor the Siemens PLC.
  • When I'm operating using Node-Red on the local server connected to the PLC via Siemens nodes, no probelm, the data flows to the mysql db.
  • When I use the Node-Red on the IOT for doing the same I'm getting a "connection refused" error, keeping the same parameters to connect to the Mysql database:
    host: localhost
    port: 3306
    user: ****
    password: ****
    database: database_name

Can you give me some hints on how to solve it.?
The IOT machine has is own ip, so it is like I'm trying to connect to a remote server when I try to go from the IOT to the local?

Thanks a lot in advance for your help.

Is mysql running on the IOT device? If not then you have to give the node the IP address where the mysql server is running.
If mysql is running on that device then are you able to run a terminal in the device and connect to the database using another client such as the mysql command line client?

Hi Colin,
thanks for replying. No the mysql is not running on the IOT, but on our local server.
So the correct approach should be write the ip address of the mysql db (plus port)?
Example: could work?

Thanks for your reply.

I haven't got that node installed at the moment but I suspect the address and port are in different fields, in which case just put the ip address in the server field and the port in the port field, obviously.
Since in your original setup node-red was running on the same machine as mysql (assuming your original working flow specified localhost) then you may also need to configure mysql to allow connections from other machines. Or you may have that configured already. Try it and see.

Ok, I'll try.
You're right the mysql node ask the port value in a specific field, so I will try adding the ip address and the port. In order to allow a local mysql machine to be reachable from outside have I to do something on the my.ini? I'm using XAMPP as local server.
Thanks for the reply.

Yes - that is standard mysql setup work.

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