I'm using NODE MYSQL2 as a connection to my database.
I put it in a subflow.
I added an OUTPUT Status.
But when you have this option, it completely crashes NODE-RED and I need to manually restart.
[{"id":"4639c7fae2510b5a","type":"subflow","name":"PrepBD","info":"","category":"","in":[{"x":80,"y":100,"wires":[{"id":"8cc0b55b7d0743c0"}]}],"out":[{"x":1020,"y":100,"wires":[{"id":"4135b832b386a610","port":0}]}],"env":[],"meta":{},"color":"#DDAA99","status":{"x":1020,"y":180,"wires":[{"id":"4135b832b386a610","port":0}]}},{"id":"8cc0b55b7d0743c0","type":"change","z":"4639c7fae2510b5a","name":"copy flow/global to msg","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.ip","pt":"msg","to":"IP_vGlobalBD","tot":"global"},{"t":"set","p":"payload.porta","pt":"msg","to":"Porta_vGlobalBD","tot":"global"},{"t":"set","p":"payload.usuario","pt":"msg","to":"Usuario_vGlobalBD","tot":"global"},{"t":"set","p":"payload.senha","pt":"msg","to":"Senha_vGlobalBD","tot":"global"},{"t":"set","p":"payload.nomeBD","pt":"msg","to":"NomeBD_vGlobalBD","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":100,"wires":[["effa65099dd2a525"]]},{"id":"4135b832b386a610","type":"mysql2","z":"4639c7fae2510b5a","name":"","server":"","bind":"","topic":"","x":760,"y":100,"wires":[[]]},{"id":"effa65099dd2a525","type":"function","z":"4639c7fae2510b5a","name":"prep_MQTT_Conn","func":"\nconst ip = msg.payload.ip\nconst porta = msg.payload.porta\nconst usuario = msg.payload.usuario\nconst senha = msg.payload.senha\nconst nomeBD = msg.payload.nomeBD\n\nmsg.server = {\n \"host\": ip,\n \"port\": porta,\n \"username\": usuario,\n \"password\": senha,\n \"db\": nomeBD\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":100,"wires":[["4135b832b386a610"]]},{"id":"eb96b8b79efaea17","type":"change","z":"4639c7fae2510b5a","name":"","rules":[{"t":"set","p":"server","pt":"msg","to":"{'host': $globalContext('IP_vGlobalBD'),\t 'port': $globalContext('Porta_vGlobalBD'),\t 'username': $globalContext('Usuario_vGlobalBD'),\t 'password': $globalContext('Senha_vGlobalBD'),\t 'bd': \"TelemetriaEnervision\"\t }","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":260,"wires":[[]]},{"id":"4a50ea77c5d0ed5b","type":"comment","z":"4639c7fae2510b5a","name":"Quem sabe futuro usar esse Change","info":"Não consegui fazer funcionar com o mysql2, ele diz que o nome do banco de dados não está selecionado.","x":320,"y":220,"wires":[]}]
Jan 26 16:23:49 DietPi node-red[1957]: at Object.connect (/mnt/dietpi_userdata/node-red/node_modules/node-red-contrib-mysql2/nodes/utils.js:5:12)
Jan 26 16:23:49 DietPi node-red[1957]: at MySql2._inputCallback (/mnt/dietpi_userdata/node-red/node_modules/node-red-contrib-mysql2/nodes/mysql2.js:52:50)
Jan 26 16:23:49 DietPi node-red[1957]: at /mnt/dietpi_userdata/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:210:26
Jan 26 16:23:49 DietPi node-red[1957]: at Object.trigger (/mnt/dietpi_userdata/node-red/node_modules/@node-red/util/lib/hooks.js:166:13)
Jan 26 16:23:49 DietPi node-red[1957]: at Node._emitInput (/mnt/dietpi_userdata/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:202:11)
Jan 26 16:23:49 DietPi systemd[1]: node-red.service: Main process exited, code=exited, status=1/FAILURE
Jan 26 16:23:49 DietPi systemd[1]: node-red.service: Failed with result 'exit-code'.
Jan 26 16:23:49 DietPi systemd[1]: node-red.service: Consumed 15.428s CPU time.
Unfortunately this NODE should not have this behavior.