Total newb having SSH tunnel and remote MySQL access problems
Posted
by
kscott
on Server Fault
See other posts from Server Fault
or by kscott
Published on 2013-11-08T21:07:32Z
Indexed on
2013/11/09
4:00 UTC
Read the original article
Hit count: 520
I don't often work with linux or need to SSH tunnel into remote MySQL databases, so pardon my ignorance. I'm using Windows 7 and am needing to connect to a remote MySQL instance on a Linux server.
For months I had been using the HeidiSQL client application successfully. Today two things happened: the DB moved to a new server and I updated HeidiSQL, now I cannot log in to the MySQL server, when attempting I get this message from Heidi:
SQL Error (2003) in statement #0: Can't connect to MySQL server on 'localhost' (10061)
If I use Putty, I can connect to the server and get MySQL access through command line, including fetching data from the DB. I assume this means my credentials and address are correct, but do not understand why putting those same details into HeidiSQL's SSH tunnel info won't work. I also downloaded the MySQL Workbench and attempted to set up a connection through that client and got this message:
Cannot Connect to Database Server
Your connection attempt failed for user 'myusername' from your host to server at localhost:3306:
Lost connection to MySQL server at 'reading initial communication packet', system error: 0
Please:
1 Check that mysql is running on server localhost
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the myusername has rights to connect to localhost from your address (mysql rights define what clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for localhost connecting from the host address you're connecting from
From Googling around I see that it could be related to the MySQL bind-address, but I am a third party sub-contractor with no access to the MySQL settings of this box and the system admin is assuring me that I'm an idiot and need to figure it out on my end. This is completely possible but I don't know what else to try.
Edit 1 - The client settings I am using
In Heidi and MySQL Workbench I am using the following:
SSH host + port: theHostnameOfTheRemoteServer.com:22 {this is the same host I can Putty to}
SSH Username: mySSHusername {the same user name I use for my Putty connection}
SSH Password: mySSHpassword {the same password for the Putty connection}
Local port: 3307 {this is on the SSH settings tab and was defaulted to 3307 by Heidi, changing it to 3306 gives me a different error: SQL Error (1045) in statement #0: Access denied for user 'mySQLusername'@'localhost' (using password: YES)"}
MySQL host: theHostnameOfTheRemoteServer.com {consensus seems to be I should use 'localhost' here}
MySQL User: mySQLusername {which I can connect with once in with Putty}
MySQL Password: mySQLpassword {which works once in with Putty}
Port: 3306
© Server Fault or respective owner