# Mysqldump - how to create a backup of mysql database from node-red

**URL:** <https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133>\
**Category:** General\
**Tags:** mysql\
**Created:** [8 September 2023 07:17 UTC](https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133 "2023-09-08T07:17:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [8 September 2023 07:17 UTC](https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133/1 "2023-09-08T07:17:56Z")

</div>

Hi,

I tried searching forum but could not get any relevant results. so here is the question.  
How do I make a backup of my mysql database from node-red ?

I am able to create a backup using **mysqldump** command in the respective folder in windows command line opened as administrator.  
`mysqldump -u user -ppassword dbase > backup1.sql`  
How do i use this in node-red using **mysql** node ?

---

<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:** [8 September 2023 07:29 UTC](https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133/2 "2023-09-08T07:29:35Z")

</div>

You should be able to use an exec node to run the command. Use the full path to the command and use forward slashes.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [9 September 2023 00:53 UTC](https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133/4 "2023-09-09T00:53:11Z")

</div>

I tried, its not working. i am doing something wrong,  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/7/a7a916fcf81dc4cc54614a75129245b1813230b4.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/e/ee6991a3bf0ded4a036096798bdbad53b9b35df6.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:** [9 September 2023 06:15 UTC](https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133/5 "2023-09-09T06:15:20Z")

</div>

I don't use Windows, but i guess you need quotes round the command name. From the error it has stopped at the space.

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [9 September 2023 06:36 UTC](https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133/6 "2023-09-09T06:36:17Z")

</div>

quotes didnt help  
i believe i have to change directory first and then execute the mysqldump since even in cmd prompt i am unable to execute the mysqldump directly from root

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [10 September 2023 11:17 UTC](https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133/7 "2023-09-10T11:17:51Z")

</div>

I couldn't get it going through NR.  
Eventually wrote a batch file and made windows scheduler run the file every day. serves my prupose so not pursuing the NR way.

---

<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:** [24 September 2023 11:18 UTC](https://discourse.nodered.org/t/mysqldump-how-to-create-a-backup-of-mysql-database-from-node-red/81133/8 "2023-09-24T11:18:00Z")

</div>

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