# Help with nodered mysql databse

**URL:** <https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371>\
**Category:** General\
**Created:** [27 May 2020 13:37 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371 "2020-05-27T13:37:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehdizrr](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@mehdizrr](https://discourse.nodered.org/u/mehdizrr)\
**Post date:** [27 May 2020 13:37 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371/1 "2020-05-27T13:37:23Z")

</div>

hello everyone , i m new in this forum  
my project is read data from my plcsim 1200 and save it in mysql database .  
i don't know what i should set in my function  
please help me .  
thnx a lot ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/5/35c1d4332794e16ff21ad454d371fff722f924ca.png) ![Sans titre](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/f/df25d10c5249444ac5a7f15d9bfce8fbaabe7695.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 May 2020 14:06 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371/2 "2020-05-27T14:06:43Z")

</div>

Do you mean you don't know what SQL query to use or you don't know how to generate the query in node red?

---

<div class="post-metadata">

**Author:** ![mehdizrr](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@mehdizrr](https://discourse.nodered.org/u/mehdizrr)\
**Post date:** [27 May 2020 14:23 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371/3 "2020-05-27T14:23:56Z")

</div>

yes sir ! i dont know what i should generate in red node ,  
in my exempl , the input is : 2247 , my database in configured , i need only the function to save the number in my database  
thnx a lot

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 May 2020 14:47 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371/4 "2020-05-27T14:47:41Z")

</div>

This isn't really the right forum to learn about SQL (which is nothing to do with node-red of course). I would start by finding a mysql tutorial to show you the basics. Once you know what query you want to create in node-red then come back and ask for help on exactly how to do that if you are having problems.  
This looks as if it might be a good place to start

> **[MySQL Tutorial - Learn MySQL Fast, Easy and Fun.](https://www.mysqltutorial.org/)**
>
> MySQL Tutorial website provides you with the most comprehensive MySQL tutorial that helps you learn MySQL fast, easy & fun.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 May 2020 14:58 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371/5 "2020-05-27T14:58:15Z")

</div>

Once you have figured out your query, might I suggest using the `template` node to build the query instead of a `function` node. I find it much easier to do.

Take a look inn the `Flows` tab and search for 'MYSQL example to chart data' to see an example.

---

<div class="post-metadata">

**Author:** ![mehdizrr](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@mehdizrr](https://discourse.nodered.org/u/mehdizrr)\
**Post date:** [27 May 2020 15:29 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371/6 "2020-05-27T15:29:20Z")

</div>

thank you sir for your response ,  
I just started on node-red, after adding 'template' I don't know how to fill it out  
i try this function and it's don't work ![3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/44100647e5dbcac90558e960634335192b3625e5.png) ![4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3acb7a7823b243daf6076d3cf4fdd3b131a1149f.jpeg)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 May 2020 15:34 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371/7 "2020-05-27T15:34:39Z")

</div>

Did you import the example flow and look at what it is doing?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 July 2020 15:34 UTC](https://discourse.nodered.org/t/help-with-nodered-mysql-databse/27371/8 "2020-07-26T15:34:41Z")

</div>

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