How to use Putty to tunnel to database
I am trying to connect to a remote MySQL database on an Ubuntu 18.04 server using a putty tunnel on my Windows 10 home computer.
Using putty, I can connect to my Ubuntu server terminal via SSH. This step is fine. I then add a tunnel that uses local port 3307 and points to port 3306 on the remote server. (screenshot below).
Then, when I run the putty session, I would expect that I could open a database tool, like DBeaver, and create a connection to localhost:3307
and that would connect me to the remote server's MySQL database on 3306. When I try this, I get an error. Am I missing a crucial step?
I know there are other ways to connect to the remote database (including a built-in SSH tunnel in DBeaver, which, for the record, works fine!), but I need to use a putty-like SSH tunnel for the workflow I'm trying. DBeaver was just an example that shows the same error as my programmed workflow. So please keep your support relative to that train of thought, thank you.
Putty Event Log
2019-01-15 10:47:02 Connecting to 159.###.###.74 port 22
2019-01-15 10:47:02 We claim version: SSH-2.0-PuTTY_Release_0.70
2019-01-15 10:47:02 Server version: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
2019-01-15 10:47:02 Using SSH protocol version 2
2019-01-15 10:47:02 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
2019-01-15 10:47:03 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
2019-01-15 10:47:03 Host key fingerprint is:
2019-01-15 10:47:03 ssh-ed25519 256 ##:##:##:##:##:##:##:##:##:##:##:##:##:##:##:##
2019-01-15 10:47:03 Initialised AES-256 SDCTR client->server encryption
2019-01-15 10:47:03 Initialised HMAC-SHA-256 client->server MAC algorithm
2019-01-15 10:47:03 Initialised AES-256 SDCTR server->client encryption
2019-01-15 10:47:03 Initialised HMAC-SHA-256 server->client MAC algorithm
2019-01-15 10:47:10 Sent password
2019-01-15 10:47:10 Access granted
2019-01-15 10:47:10 Opening session as main channel
2019-01-15 10:47:11 Opened main channel
2019-01-15 10:47:11 Local port 3307 forwarding to 159.###.###.74:3306
2019-01-15 10:47:11 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2019-01-15 10:47:11 Started a shell/command
ssh mysql putty tunnel ubuntu-18.04
add a comment |
I am trying to connect to a remote MySQL database on an Ubuntu 18.04 server using a putty tunnel on my Windows 10 home computer.
Using putty, I can connect to my Ubuntu server terminal via SSH. This step is fine. I then add a tunnel that uses local port 3307 and points to port 3306 on the remote server. (screenshot below).
Then, when I run the putty session, I would expect that I could open a database tool, like DBeaver, and create a connection to localhost:3307
and that would connect me to the remote server's MySQL database on 3306. When I try this, I get an error. Am I missing a crucial step?
I know there are other ways to connect to the remote database (including a built-in SSH tunnel in DBeaver, which, for the record, works fine!), but I need to use a putty-like SSH tunnel for the workflow I'm trying. DBeaver was just an example that shows the same error as my programmed workflow. So please keep your support relative to that train of thought, thank you.
Putty Event Log
2019-01-15 10:47:02 Connecting to 159.###.###.74 port 22
2019-01-15 10:47:02 We claim version: SSH-2.0-PuTTY_Release_0.70
2019-01-15 10:47:02 Server version: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
2019-01-15 10:47:02 Using SSH protocol version 2
2019-01-15 10:47:02 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
2019-01-15 10:47:03 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
2019-01-15 10:47:03 Host key fingerprint is:
2019-01-15 10:47:03 ssh-ed25519 256 ##:##:##:##:##:##:##:##:##:##:##:##:##:##:##:##
2019-01-15 10:47:03 Initialised AES-256 SDCTR client->server encryption
2019-01-15 10:47:03 Initialised HMAC-SHA-256 client->server MAC algorithm
2019-01-15 10:47:03 Initialised AES-256 SDCTR server->client encryption
2019-01-15 10:47:03 Initialised HMAC-SHA-256 server->client MAC algorithm
2019-01-15 10:47:10 Sent password
2019-01-15 10:47:10 Access granted
2019-01-15 10:47:10 Opening session as main channel
2019-01-15 10:47:11 Opened main channel
2019-01-15 10:47:11 Local port 3307 forwarding to 159.###.###.74:3306
2019-01-15 10:47:11 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2019-01-15 10:47:11 Started a shell/command
ssh mysql putty tunnel ubuntu-18.04
What does PuTTY even log say? What is159....74
?
– Martin Prikryl
Jan 15 at 15:26
That's my remote server IP. I blurred some of it for privacy. I don't see anything in the Event Viewer for Putty. I did see a putty.log file but it only shows what my terminal session text shows so it's unrelated to the tunnel.
– Frantumn
Jan 15 at 15:37
I've asked for PuTTY event log (right click PuTTY window caption) + Did you trylocalhost
instead of the IP, as you are connecting to the server itself?
– Martin Prikryl
Jan 15 at 16:12
@MartinPrikryl Thank you for explaining where the log was. I didn't ever know that was there! I've added the log to my post. I've replaced some numbers with # again, for privacy. And yes, I've tried using localhost instead of the remote server IP. It doesn't work.
– Frantumn
Jan 15 at 16:22
@KamilMaciorowski That did it! I had tried localhost:3306, as mentioned above, but not 127.0.0.1:3306. After trying that it worked. Thank you! Feel free to make that the solution if you want.
– Frantumn
Jan 15 at 16:43
add a comment |
I am trying to connect to a remote MySQL database on an Ubuntu 18.04 server using a putty tunnel on my Windows 10 home computer.
Using putty, I can connect to my Ubuntu server terminal via SSH. This step is fine. I then add a tunnel that uses local port 3307 and points to port 3306 on the remote server. (screenshot below).
Then, when I run the putty session, I would expect that I could open a database tool, like DBeaver, and create a connection to localhost:3307
and that would connect me to the remote server's MySQL database on 3306. When I try this, I get an error. Am I missing a crucial step?
I know there are other ways to connect to the remote database (including a built-in SSH tunnel in DBeaver, which, for the record, works fine!), but I need to use a putty-like SSH tunnel for the workflow I'm trying. DBeaver was just an example that shows the same error as my programmed workflow. So please keep your support relative to that train of thought, thank you.
Putty Event Log
2019-01-15 10:47:02 Connecting to 159.###.###.74 port 22
2019-01-15 10:47:02 We claim version: SSH-2.0-PuTTY_Release_0.70
2019-01-15 10:47:02 Server version: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
2019-01-15 10:47:02 Using SSH protocol version 2
2019-01-15 10:47:02 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
2019-01-15 10:47:03 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
2019-01-15 10:47:03 Host key fingerprint is:
2019-01-15 10:47:03 ssh-ed25519 256 ##:##:##:##:##:##:##:##:##:##:##:##:##:##:##:##
2019-01-15 10:47:03 Initialised AES-256 SDCTR client->server encryption
2019-01-15 10:47:03 Initialised HMAC-SHA-256 client->server MAC algorithm
2019-01-15 10:47:03 Initialised AES-256 SDCTR server->client encryption
2019-01-15 10:47:03 Initialised HMAC-SHA-256 server->client MAC algorithm
2019-01-15 10:47:10 Sent password
2019-01-15 10:47:10 Access granted
2019-01-15 10:47:10 Opening session as main channel
2019-01-15 10:47:11 Opened main channel
2019-01-15 10:47:11 Local port 3307 forwarding to 159.###.###.74:3306
2019-01-15 10:47:11 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2019-01-15 10:47:11 Started a shell/command
ssh mysql putty tunnel ubuntu-18.04
I am trying to connect to a remote MySQL database on an Ubuntu 18.04 server using a putty tunnel on my Windows 10 home computer.
Using putty, I can connect to my Ubuntu server terminal via SSH. This step is fine. I then add a tunnel that uses local port 3307 and points to port 3306 on the remote server. (screenshot below).
Then, when I run the putty session, I would expect that I could open a database tool, like DBeaver, and create a connection to localhost:3307
and that would connect me to the remote server's MySQL database on 3306. When I try this, I get an error. Am I missing a crucial step?
I know there are other ways to connect to the remote database (including a built-in SSH tunnel in DBeaver, which, for the record, works fine!), but I need to use a putty-like SSH tunnel for the workflow I'm trying. DBeaver was just an example that shows the same error as my programmed workflow. So please keep your support relative to that train of thought, thank you.
Putty Event Log
2019-01-15 10:47:02 Connecting to 159.###.###.74 port 22
2019-01-15 10:47:02 We claim version: SSH-2.0-PuTTY_Release_0.70
2019-01-15 10:47:02 Server version: SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
2019-01-15 10:47:02 Using SSH protocol version 2
2019-01-15 10:47:02 Doing ECDH key exchange with curve Curve25519 and hash SHA-256
2019-01-15 10:47:03 Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
2019-01-15 10:47:03 Host key fingerprint is:
2019-01-15 10:47:03 ssh-ed25519 256 ##:##:##:##:##:##:##:##:##:##:##:##:##:##:##:##
2019-01-15 10:47:03 Initialised AES-256 SDCTR client->server encryption
2019-01-15 10:47:03 Initialised HMAC-SHA-256 client->server MAC algorithm
2019-01-15 10:47:03 Initialised AES-256 SDCTR server->client encryption
2019-01-15 10:47:03 Initialised HMAC-SHA-256 server->client MAC algorithm
2019-01-15 10:47:10 Sent password
2019-01-15 10:47:10 Access granted
2019-01-15 10:47:10 Opening session as main channel
2019-01-15 10:47:11 Opened main channel
2019-01-15 10:47:11 Local port 3307 forwarding to 159.###.###.74:3306
2019-01-15 10:47:11 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2019-01-15 10:47:11 Started a shell/command
ssh mysql putty tunnel ubuntu-18.04
ssh mysql putty tunnel ubuntu-18.04
edited Jan 15 at 16:21
Frantumn
asked Jan 15 at 14:57
FrantumnFrantumn
5012825
5012825
What does PuTTY even log say? What is159....74
?
– Martin Prikryl
Jan 15 at 15:26
That's my remote server IP. I blurred some of it for privacy. I don't see anything in the Event Viewer for Putty. I did see a putty.log file but it only shows what my terminal session text shows so it's unrelated to the tunnel.
– Frantumn
Jan 15 at 15:37
I've asked for PuTTY event log (right click PuTTY window caption) + Did you trylocalhost
instead of the IP, as you are connecting to the server itself?
– Martin Prikryl
Jan 15 at 16:12
@MartinPrikryl Thank you for explaining where the log was. I didn't ever know that was there! I've added the log to my post. I've replaced some numbers with # again, for privacy. And yes, I've tried using localhost instead of the remote server IP. It doesn't work.
– Frantumn
Jan 15 at 16:22
@KamilMaciorowski That did it! I had tried localhost:3306, as mentioned above, but not 127.0.0.1:3306. After trying that it worked. Thank you! Feel free to make that the solution if you want.
– Frantumn
Jan 15 at 16:43
add a comment |
What does PuTTY even log say? What is159....74
?
– Martin Prikryl
Jan 15 at 15:26
That's my remote server IP. I blurred some of it for privacy. I don't see anything in the Event Viewer for Putty. I did see a putty.log file but it only shows what my terminal session text shows so it's unrelated to the tunnel.
– Frantumn
Jan 15 at 15:37
I've asked for PuTTY event log (right click PuTTY window caption) + Did you trylocalhost
instead of the IP, as you are connecting to the server itself?
– Martin Prikryl
Jan 15 at 16:12
@MartinPrikryl Thank you for explaining where the log was. I didn't ever know that was there! I've added the log to my post. I've replaced some numbers with # again, for privacy. And yes, I've tried using localhost instead of the remote server IP. It doesn't work.
– Frantumn
Jan 15 at 16:22
@KamilMaciorowski That did it! I had tried localhost:3306, as mentioned above, but not 127.0.0.1:3306. After trying that it worked. Thank you! Feel free to make that the solution if you want.
– Frantumn
Jan 15 at 16:43
What does PuTTY even log say? What is
159....74
?– Martin Prikryl
Jan 15 at 15:26
What does PuTTY even log say? What is
159....74
?– Martin Prikryl
Jan 15 at 15:26
That's my remote server IP. I blurred some of it for privacy. I don't see anything in the Event Viewer for Putty. I did see a putty.log file but it only shows what my terminal session text shows so it's unrelated to the tunnel.
– Frantumn
Jan 15 at 15:37
That's my remote server IP. I blurred some of it for privacy. I don't see anything in the Event Viewer for Putty. I did see a putty.log file but it only shows what my terminal session text shows so it's unrelated to the tunnel.
– Frantumn
Jan 15 at 15:37
I've asked for PuTTY event log (right click PuTTY window caption) + Did you try
localhost
instead of the IP, as you are connecting to the server itself?– Martin Prikryl
Jan 15 at 16:12
I've asked for PuTTY event log (right click PuTTY window caption) + Did you try
localhost
instead of the IP, as you are connecting to the server itself?– Martin Prikryl
Jan 15 at 16:12
@MartinPrikryl Thank you for explaining where the log was. I didn't ever know that was there! I've added the log to my post. I've replaced some numbers with # again, for privacy. And yes, I've tried using localhost instead of the remote server IP. It doesn't work.
– Frantumn
Jan 15 at 16:22
@MartinPrikryl Thank you for explaining where the log was. I didn't ever know that was there! I've added the log to my post. I've replaced some numbers with # again, for privacy. And yes, I've tried using localhost instead of the remote server IP. It doesn't work.
– Frantumn
Jan 15 at 16:22
@KamilMaciorowski That did it! I had tried localhost:3306, as mentioned above, but not 127.0.0.1:3306. After trying that it worked. Thank you! Feel free to make that the solution if you want.
– Frantumn
Jan 15 at 16:43
@KamilMaciorowski That did it! I had tried localhost:3306, as mentioned above, but not 127.0.0.1:3306. After trying that it worked. Thank you! Feel free to make that the solution if you want.
– Frantumn
Jan 15 at 16:43
add a comment |
1 Answer
1
active
oldest
votes
In putty, my forward destination should have been 127.0.0.1:3306 instead of the public IP. I tried using localhost:3306 and that didn't work. It had to be 127.0.0.1 because that was all that MySQL was set to listen to.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394559%2fhow-to-use-putty-to-tunnel-to-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In putty, my forward destination should have been 127.0.0.1:3306 instead of the public IP. I tried using localhost:3306 and that didn't work. It had to be 127.0.0.1 because that was all that MySQL was set to listen to.
add a comment |
In putty, my forward destination should have been 127.0.0.1:3306 instead of the public IP. I tried using localhost:3306 and that didn't work. It had to be 127.0.0.1 because that was all that MySQL was set to listen to.
add a comment |
In putty, my forward destination should have been 127.0.0.1:3306 instead of the public IP. I tried using localhost:3306 and that didn't work. It had to be 127.0.0.1 because that was all that MySQL was set to listen to.
In putty, my forward destination should have been 127.0.0.1:3306 instead of the public IP. I tried using localhost:3306 and that didn't work. It had to be 127.0.0.1 because that was all that MySQL was set to listen to.
answered Jan 15 at 16:58
FrantumnFrantumn
5012825
5012825
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394559%2fhow-to-use-putty-to-tunnel-to-database%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What does PuTTY even log say? What is
159....74
?– Martin Prikryl
Jan 15 at 15:26
That's my remote server IP. I blurred some of it for privacy. I don't see anything in the Event Viewer for Putty. I did see a putty.log file but it only shows what my terminal session text shows so it's unrelated to the tunnel.
– Frantumn
Jan 15 at 15:37
I've asked for PuTTY event log (right click PuTTY window caption) + Did you try
localhost
instead of the IP, as you are connecting to the server itself?– Martin Prikryl
Jan 15 at 16:12
@MartinPrikryl Thank you for explaining where the log was. I didn't ever know that was there! I've added the log to my post. I've replaced some numbers with # again, for privacy. And yes, I've tried using localhost instead of the remote server IP. It doesn't work.
– Frantumn
Jan 15 at 16:22
@KamilMaciorowski That did it! I had tried localhost:3306, as mentioned above, but not 127.0.0.1:3306. After trying that it worked. Thank you! Feel free to make that the solution if you want.
– Frantumn
Jan 15 at 16:43