# MySQL via SSH tunnel

**URL:** https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110
**Category:** General
**Created:** [13 February 2023 11:48 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110 "2023-02-13T11:48:52Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![grant.cpt](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@grant.cpt](https://discourse.nodered.org/u/grant.cpt)
#### Post date: [13 February 2023 11:48 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/1 "2023-02-13T11:48:53Z")

</div>

Hi all,

Currently trying to establish a connection to MySQL but via SSH tunnel. Anyone been able to get this right?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [13 February 2023 13:05 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/2 "2023-02-13T13:05:46Z")

</div>

You will need to share more information about what type of VPN you are using.

---

<div class="post-metadata">

### Author: ![grant.cpt](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@grant.cpt](https://discourse.nodered.org/u/grant.cpt)
#### Post date: [13 February 2023 13:19 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/3 "2023-02-13T13:19:20Z")

</div>

No VPN is used. Just that all our DB's need to be connected via an SSH "jump box" first.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [13 February 2023 13:25 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/4 "2023-02-13T13:25:00Z")

</div>

Sorry, yes, should have seen that.

I've done similar things in the past but not for some time. What problems are you getting?

---

<div class="post-metadata">

### Author: ![grant.cpt](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@grant.cpt](https://discourse.nodered.org/u/grant.cpt)
#### Post date: [13 February 2023 16:12 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/5 "2023-02-13T16:12:54Z")

</div>

Basically not sure how to encapsulate the MySQL node in an SSH tunnel. Is the any nodes you used that helped you?

---

<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: [13 February 2023 16:42 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/6 "2023-02-13T16:42:50Z")

</div>

If you were not using node-red how would you access the db?

---

<div class="post-metadata">

### Author: ![grant.cpt](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@grant.cpt](https://discourse.nodered.org/u/grant.cpt)
#### Post date: [13 February 2023 16:49 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/7 "2023-02-13T16:49:54Z")

</div>

Via Dbeaver

---

<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: [13 February 2023 17:41 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/8 "2023-02-13T17:41:45Z")

</div>

Does that have built in support for tunnels?

---

<div class="post-metadata">

### Author: ![grant.cpt](https://avatars.discourse-cdn.com/v4/letter/g/eb8c5e/32.png) [@grant.cpt](https://discourse.nodered.org/u/grant.cpt)
#### Post date: [13 February 2023 17:53 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/9 "2023-02-13T17:53:31Z")

</div>

Yes, that's why I use it. But so does MySQL Workbench

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [13 February 2023 18:05 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/10 "2023-02-13T18:05:30Z")

</div>

> [@grant.cpt](#):
>
> Basically not sure how to encapsulate the MySQL node in an SSH tunnel. Is the any nodes you used that helped you?

You don't 🙂

You tell the SSH client to create a link from a local port to the remote ip/port. Of course, the remote server's SSH service must be configured to allow port forwarding. You can also pre-configure the remote SSH service with port forwarding.

Sorry I can't be more explicit but its been a while since I last did it and I can't remember the exact commands. But a quick search for something like "ssh port forwarding" should be sufficient.

---

<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: [14 April 2023 18:06 UTC](https://discourse.nodered.org/t/mysql-via-ssh-tunnel/75110/11 "2023-04-14T18:06:26Z")

</div>

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