# Unable to connect to DB

**URL:** <https://discourse.nodered.org/t/unable-to-connect-to-db/34422>\
**Category:** General\
**Created:** [17 October 2020 16:53 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422 "2020-10-17T16:53:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 16:53 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/1 "2020-10-17T16:53:24Z")

</div>

Hi,

I'm getting the connection error shown below.  
I recreated the link with no avail. Rewritten the credentials with no avail either.  
My ESP connects to the DB without a problem using the same credentials.  
How can I troubleshoot my problem?

TIA

`Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'user_iot'@'82.179.66.52' (using password: YES)`

---

<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:** [17 October 2020 17:07 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/2 "2020-10-17T17:07:55Z")

</div>

What database type is that?  
The error suggests that you are trying to connect from a Russian IP address on the internet, are you trying to access a database across the internet?

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 19:47 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/3 "2020-10-17T19:47:21Z")

</div>

🤔Russian? I’m in Spain and I’m connecting to my ISP’s mySql server which is about 20km from me. Will look up on that ip. Thanks.

EDIT: I remember now I made some changes to that IP for troubleshooting reason. The actual IP is 82.159.77.52.

---

<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:** [17 October 2020 19:56 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/4 "2020-10-17T19:56:59Z")

</div>

Can you connect from the command line mysql client on the machine running node-red? Something like  
`mysql --host=<mysql host ip> --user=user_iot --password=<thepassword>`

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:01 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/5 "2020-10-17T20:01:02Z")

</div>

😅 It looks like on this new rpi board I didn't install mysql:

`-bash: mysql: command not found`

---

<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:** [17 October 2020 20:01 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/6 "2020-10-17T20:01:59Z")

</div>

> [@ebolisa](#):
>
> I made some changes to that IP for troubleshooting reason

What do you mean you made changes to the IP? That should be the external IP of the system. You can't change it (well not usually).

---

<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:** [17 October 2020 20:03 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/7 "2020-10-17T20:03:02Z")

</div>

> [@ebolisa](#):
>
> mysql: command not found

I think you probably need to install mysql-client to get the command line client.  
`sudo apt install mysql-client`  
Node red shouldn't need that though.

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:03 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/8 "2020-10-17T20:03:21Z")

</div>

> [@ebolisa](#):
>
> 82.159.77.52

I know but I was just playing with the IP to see if the error would change.

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:05 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/9 "2020-10-17T20:05:38Z")

</div>

`Package 'mysql-client' has no installation candidate`

I guess I need to install the whole DB package?

---

<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:** [17 October 2020 20:05 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/10 "2020-10-17T20:05:40Z")

</div>

I don't understand how you could play with the IP. You shouldn't be specifying it anywhere, it is automatic.

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:07 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/11 "2020-10-17T20:07:13Z")

</div>

In the mysql config window you can set the ip, the user and the password.

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:08 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/12 "2020-10-17T20:08:17Z")

</div>

The mysql server is not on my machine. It's located on the ISP's server.

---

<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:** [17 October 2020 20:09 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/13 "2020-10-17T20:09:30Z")

</div>

That is the IP of the server, not the ip of the pi. The error is saying you can't connect to the server _from_ 82.179.66.52. At least I think that is what it is saying.

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:11 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/14 "2020-10-17T20:11:55Z")

</div>

Actually, [https://www.whatismyip.com/](https://www.whatismyip.com/) returns a different IP, so it's not mine but ISP's.

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:13 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/15 "2020-10-17T20:13:24Z")

</div>

Anyhow, as I stated earlier, I have no problems with my ESP connecting to the mysql server with the identical credentials.

---

<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:** [17 October 2020 20:13 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/16 "2020-10-17T20:13:28Z")

</div>

> [@ebolisa](#):
>
> I guess I need to install the whole DB package?

That is a pain, it seems the mysql client isn't in a separate package in Raspbian.  
When you said you could connect from ESP, what did you mean by that?

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:14 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/17 "2020-10-17T20:14:45Z")

</div>

The ESP sends the data to the server every so often. Node-red reads it and display it.

---

<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:** [17 October 2020 20:15 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/18 "2020-10-17T20:15:00Z")

</div>

What is an ESP?

---

<div class="post-metadata">

**Author:** ![ebolisa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ebolisa/32/89203_2.png) [@ebolisa](https://discourse.nodered.org/u/ebolisa)\
**Post date:** [17 October 2020 20:15 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/19 "2020-10-17T20:15:53Z")

</div>

Sorry, ESP/ESP8266/ESP32 are microcontrollers.

---

<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:** [17 October 2020 20:18 UTC](https://discourse.nodered.org/t/unable-to-connect-to-db/34422/20 "2020-10-17T20:18:02Z")

</div>

Is that on the same local network as the pi?

[Next page](https://discourse.nodered.org/t/unable-to-connect-to-db/34422.md?page=2)
