Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7489957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:27:20+00:00 2026-05-29T15:27:20+00:00

When I attempt to access mysql over an SSH tunnel, I get the error:

  • 0

When I attempt to access mysql over an SSH tunnel, I get the error:

ERROR 2005 (HY000): Unknown MySQL server host '[serverhost]' (0)

When I make the attempt through MySQL Workbench or over an ordinary SSH CLI, it works fine, though. What am I doing wrong? (I have scanned multiple related threads on this site, but none that explained this behaviour to me.)

TMI:

The host I have is a name, not an IP.

I open the tunnel thus:

plink.exe [user]@[remote-ip] -P [ssh-port] -pw [pw] -L [local-listen-port]:localhost:[remote-mysql-port]

I call mysql on my command line (through tunnel) thus:

mysql -h [serverhost] -u [user] -p[pw] --port [local-listen-port]

I call mysql over an SSH command line (no tunnel) thus:

mysql -h [serverhost] -u [user] -p[pw] --port [remote-mysql-port]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:27:22+00:00Added an answer on May 29, 2026 at 3:27 pm

    Your existing plink command is wrong, as its specifying localhost as the destination address (which is the localhost on the other side of the SSH session, so [remote-ip], by your reckoning, which is why you are getting an error) – it should be [serverhost].

    Then, you are then mistakenly attempting to connect mysql directly to [serverhost], but the tunnel does not affect routing, so that is incorrect, you should be connecting to localhost.

    Your existing example command works when connected to an ssh shell session on [remote-ip], because you are connecting from [remote-ip], which has access to [serverhost] presumably.

    Assuming [serverhost] is the remote server, your commands should be:

    plink.exe [user]@[remote-ip] -P [ssh-port] -pw [pw] -L [local-listen-port]:[serverhost]:[remote-mysql-port]
    

    Then

    mysql -h localhost -u [user] -p[pw] --port [local-listen-port]
    

    EDIT: Let me try and diagram it for you, since you are obviously misunderstanding the nature of the tunnel:

    The SSH connection

    localhost[?] <——–> remote-ip[22]

    The tunnel

    localhost[local-port] <—- SSH —> remote-ip[22] <— TCP —>
    serverhost[remote-port]

    Therefore, SSH/plink has bound a port on localhost, using the [local-port] number you have specified, that, when receiving a connection request, establishes a connection from [remote-ip] to [serverhost:remote-port], then shuffles the sends/receives back and forth between them, using its own SSH connection for the hop from [localhost] to [remote-ip].

    So – once the tunnel has been set up, to access [serverhost:remote-port], you actually point your tools at [localhost:local-port], and the tunnel routes the traffic to the appropriate place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting an 'access is denied' error when I attempt to delete a
Webkit Develoepr tools says the following Javascript Error: Unsafe JavaScript attempt to access frame
I have a SQL 2005 x64 server, and when I attempt to issue some
Chrome display this error in console Unsafe JavaScript attempt to access frame with URL
Im getting this error: Unsafe JavaScript attempt to access frame with URL URL1 from
I'm having a problem connecting to a MySQL server over two different trusted domains.
I'm getting a very odd error when I attempt to access the find method
I installed php and mysql on a Windows 2003 server running IIS6. I uncommented
When I attempt to access this specific pointer, the application crashes and shows a
I am getting this exception when I attempt to access an object that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.