# Can't Connect database mysql

**URL:** <https://discourse.nodered.org/t/cant-connect-database-mysql/17988>\
**Category:** General\
**Created:** [15 November 2019 09:52 UTC](https://discourse.nodered.org/t/cant-connect-database-mysql/17988 "2019-11-15T09:52:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![madihatunn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/madihatunn/32/13567_2.png) [@madihatunn](https://discourse.nodered.org/u/madihatunn)\
**Post date:** [15 November 2019 09:52 UTC](https://discourse.nodered.org/t/cant-connect-database-mysql/17988/1 "2019-11-15T09:52:17Z")

</div>

hi:) i wanna ask something. i have problem when i try to insert my value sensor or input to database mysql. some error show on this picture.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e91f38dacba4d6e8dd06a0ea56b7987521c31fd7.png)

how can i fix it? can help me please?? what should i do? thank you

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [15 November 2019 10:03 UTC](https://discourse.nodered.org/t/cant-connect-database-mysql/17988/2 "2019-11-15T10:03:12Z")

</div>

Hi @madihatunn

that suggests there is some configuration issue with the database node you are using.

What node module are you using for the database node?  
How have you configured it?  
Have you checked the mysql database you are using is running and accepting connections in general?

---

<div class="post-metadata">

**Author:** ![madihatunn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/madihatunn/32/13567_2.png) [@madihatunn](https://discourse.nodered.org/u/madihatunn)\
**Post date:** [15 November 2019 10:09 UTC](https://discourse.nodered.org/t/cant-connect-database-mysql/17988/3 "2019-11-15T10:09:27Z")

</div>

i used mysql database node, like this ![database](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/20953ac8fb228eb180f5d9849d91a8343b57f356.png) and the configuration in node like on this picture bellow

 ![configuration%20mysql%20database%20node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e0b5031685bab86be138a53df5d98082692fe299.png)  
i'm sure the mysql database connected

---

<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:** [15 November 2019 11:11 UTC](https://discourse.nodered.org/t/cant-connect-database-mysql/17988/4 "2019-11-15T11:11:31Z")

</div>

Is mysql running on the same machine as node-red? If so then try localhost rather than ip address.  
Can you access the server from the node red machine using another sql client such as the msql command line?

---

<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:** [15 November 2019 11:12 UTC](https://discourse.nodered.org/t/cant-connect-database-mysql/17988/5 "2019-11-15T11:12:24Z")

</div>

Also you have not said which mysql node you are using. Possibly node-red-contrib-something.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [15 November 2019 16:35 UTC](https://discourse.nodered.org/t/cant-connect-database-mysql/17988/6 "2019-11-15T16:35:15Z")

</div>

Have you configured mysql server to allow remote connections - these days it defaults to not allowing outside connections for security.
