MySQL with Node-RED

Node-RED & MySQL Integration: Create, Delete, Insert, Select and Display Data on Dashboard

[{"id":"7e85d531f9394536","type":"tab","label":"MySQL with Node-RED","disabled":false,"info":"","env":[],"_mcu":{"mcu":false}},{"id":"f23926afe7ec5fd4","type":"mysql","z":"7e85d531f9394536","mydb":"e5821f4c6af71841","name":"MySQL DB Connector","_mcu":{"mcu":false},"x":430,"y":160,"wires":[["9f9265a807c60dce"]]},{"id":"c905634955178290","type":"inject","z":"7e85d531f9394536","name":"Create Table","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CREATE TABLE IF NOT EXISTS sensor_data (     id INT AUTO_INCREMENT PRIMARY KEY,     timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,     temp FLOAT,     humidity FLOAT );","_mcu":{"mcu":false},"x":190,"y":80,"wires":[["f23926afe7ec5fd4"]]},{"id":"9e7e7be7b20ee4b2","type":"inject","z":"7e85d531f9394536","name":"Delete Table","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"DROP TABLE IF EXISTS sensor_data;","_mcu":{"mcu":false},"x":190,"y":140,"wires":[["f23926afe7ec5fd4"]]},{"id":"b01beb074cdcbaba","type":"inject","z":"7e85d531f9394536","name":"INSERT Into Table - 1","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"INSERT INTO sensor_data (temp, humidity) VALUES (25.5, 60.2);","_mcu":{"mcu":false},"x":160,"y":200,"wires":[["f23926afe7ec5fd4"]]},{"id":"99a28246779ea1e6","type":"inject","z":"7e85d531f9394536","name":"Select From Table","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"select * from sensor_data;","_mcu":{"mcu":false},"x":170,"y":320,"wires":[["ff78199d9bb85cb1"]]},{"id":"9f9265a807c60dce","type":"debug","z":"7e85d531f9394536","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":680,"y":160,"wires":[]},{"id":"a687f4a0dde3ceaa","type":"inject","z":"7e85d531f9394536","name":"INSERT Into Table - 2","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"INSERT INTO sensor_data (temp, humidity) VALUES (26.5, 58.2);","_mcu":{"mcu":false},"x":160,"y":260,"wires":[["f23926afe7ec5fd4"]]},{"id":"480f4da26cd1cbb5","type":"ui_table","z":"7e85d531f9394536","group":"5053a1bc54e50a0c","name":"","order":0,"width":"12","height":"6","columns":[],"outputs":0,"cts":false,"_mcu":{"mcu":false},"x":670,"y":320,"wires":[]},{"id":"ff78199d9bb85cb1","type":"mysql","z":"7e85d531f9394536","mydb":"e5821f4c6af71841","name":"MySQL DB Connector","_mcu":{"mcu":false},"x":430,"y":320,"wires":[["480f4da26cd1cbb5","40717429fb59ab93"]]},{"id":"40717429fb59ab93","type":"debug","z":"7e85d531f9394536","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","_mcu":{"mcu":false},"x":680,"y":360,"wires":[]},{"id":"e5821f4c6af71841","type":"MySQLdatabase","name":"Local MySQL DB","host":"127.0.0.1","port":"3306","db":"test","tz":"","charset":"UTF8","_mcu":{"mcu":false}},{"id":"5053a1bc54e50a0c","type":"ui_group","name":"Default","tab":"29c17871668db451","order":1,"disp":true,"width":"12","collapse":false,"className":"","_mcu":{"mcu":false}},{"id":"29c17871668db451","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false,"_mcu":{"mcu":false}}]

Flow Info

Created 4 months, 2 weeks ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x2)
  • inject (x5)
Other
  • MySQLdatabase (x1)
  • mysql (x2)
  • tab (x1)
  • ui_group (x1)
  • ui_tab (x1)
  • ui_table (x1)

Tags

  • mysql
  • node-red
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option