Knowledgebase
emscom > emscom Help Desk > Knowledgebase

Search help:


MySQL SSH tunnel on OSX

Solution

OSX fails to connect mysql to ssh tunnel

SSH tunnelling is a useful method for connecting to a MySQL server which is behind a firewall and restricted to localhost users.  i.e. A web server

#create an SSH tunnel between the local port 9000 and the remote port 3306

ssh -L 9000:localhost:3306

#  connect the local mysql client

mysql --port 9000 --host localhost -u user -p  password

 

Workaround

On OSX specifying the host as localhost will cause the mysql client to attempt to connect to a socket file

/tmp/mysql.sock

which does not exist.

To work around use the loopback address to replace the hostname in the mysql command line

mysql -P 9000 -h 127.0.01 -u user -p password

 

 
Was this article helpful? yes / no
Related articles MySQL create restricted user
MySQL backup and restore
OSX MSSQL Server ODBC drivers
Wireshark capture remotely
Dell Open Manage on ESX5
Article details
Article ID: 95
Category: SQL
Date added: 21-02-2017 02:51:50
Views: 112
Rating (Votes): Article not rated yet (0)

 
« Go back

 
Powered by Help Desk Software HESK, in partnership with SysAid Technologies