There is a point to this story, but it has temporarily escaped my mind...
Contact Me MyFaceBook MyLinkedIn MyGitHub MyTwitter

Connecting MySQL Client to a Remote MySQL Server

Once in a while I need to connect to my remote MySql server using the gui tools. However, Secure Internet reachable MySql installations should be blocking the port. Luckily, SSH provides a way to connect to a remote MySql without exposing the MySql port to insecure connections…

Port Forwarding

Route your local port 3306 to the remote port 3306 on the remote host,

ssh -L 3306:localhost:3306 user@server.com -v

Connection

Now you can access the MySql instance just like you would if it were to be running on your local computer. For the MySql command line client,

mysql -h 127.0.0.1 -u <mysql_username> -d <db_name> -p

For the GUI tools, use 127.0.0.1 for the host name. Recent versions of the GUI tools makes this much easier as you can configure SSH connections directly in the GUI.

Copyright © 2015 by Julian Easterling. SOME RIGHTS RESERVED.

Creative Commons License
Except where otherwise noted, content on this site is
licensed under a Creative Common Attribution-Share Alike 4.0 International License.


All of the opinions expressed on this website are those of Julian Easterling and
do not represent the views of any of my current and previous clients or employers in any way.

If you notice an error on the site or content that has not been properly attributed, bring
it to my attention using the contact page and I will endeavor to fix it as soon as I can.

I accept no responsibility or liability for any damages incurred by following any of
my advice or by using any of the information on my site or of those sites that I link to.