当前位置:网站首页>Node-RED系列(二四):在Node-RED中使用mysql节点实现数据库的增删改查
Node-RED系列(二四):在Node-RED中使用mysql节点实现数据库的增删改查
2022-06-13 09:33:00 【拿我格子衫来】
背景介绍
今天有个学生私信我,如何实现在nr中对数据库进行操作,并进行基础的增删改查。node-red是基于nodejs开发的,如果有类似的node-red包,就能够支持数据库的链接,以及读写操作。在接到这个需求后,首先要去寻找对应的node-red包,看是否有相应的包。点击node-red右上角的菜单,点击节点管理,并点击安装, 在输入框搜索mysql,(如果你要找的是mysql数据库的读写库的话)如下图。下图就是所有有关mysql的操作库,点击库名后面的链接,可以查看该库的详情介绍。
库的安装与配置
本篇文章使用的库是 node-red-node-mysql 最新版本是1.0.1 版本,最近三个月更新的。
https://flows.nodered.org/node/node-red-node-mysql 这里是该库的详细介绍。从详情我们可以知道这个库是一个node-red 操作mysql读写的节点库。
该库 允许对 MySQL 数据库进行基本访问,如查询,插入,删除,但一定要小心sql注入。
要执行的sql语句放到msg.topic中,而结果会以msg.payload的形式向下传递。
通常,返回的有效负载将是结果行的数组。
如果没有找到该键,则返回null。
开发者 可以通过在settings.js 中添加一行来更改以毫秒为单位的重新连接重试超时
mysqlReconnectTime: 30000,
时区
边栏推荐
- Classes and objects -- Inheritance
- Exercise 7-7 string replacement (15 points)
- Haproxy + keepalived for high availability load balancing of MySQL
- [51nod p2106] an odd number of times [bit operation]
- Opencv face recognition of ros2 foxy~galactic~humble
- (bfs) acwing 847. Hierarchy of points in the graph
- Dynamic display of analog clock using digital clock in turtle Library
- Interrupt handling mechanism
- LeetCode 202. Happy number
- I set up a blog
猜你喜欢
LeetCode 1. Sum of two numbers
(bfs) acwing 847. Hierarchy of points in the graph
[51nod p3047] displacement operation [bit operation]
It was so simple to implement system call
[ssl1280] full arrangement
Classes and objects -- object model and this pointer
(bfs+GOOD) acwing 845. Eight digit
说说MySQL索引机制
[51nod p2102] or subtraction and [bit operation]
acwing 786. Number k
随机推荐
List list
LeetCode 583. Deleting two strings
[51nod p3047] displacement operation [bit operation]
LeetCode 1143. Longest common subsequence
LeetCode 322. Change
【 ssl2 ⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶⁶83
Can the operation of the new BMW I3 meet the expectations of the famous products of the 3 series?
虚拟机内存结构简述
Standard template library (STL)
I set up a blog
Knowledge points of silicon steel sheet
Learning makefile with me
GPIO of hardware schematic diagram
1-4 message passing interface [CSP authentication]
1-2 24:00 (20 points) [CSP certification true question]
谨记! 写代码别太自信! 一定要写点关键日志info输出,不然问题都定位不到。
C # introductory series (XIII) -- getting to know the structure for the first time
Collection of articles on virtualization and cloud computing
Amadahl's Law (a little thought)
MySQL monitoring tool PMM, let you go to a higher level (Part 2)