MySQL OSX Mac terminal remote connect

Asked By 0 points N/A Posted on -
qa-featured

Hello Techyv Friends,

I am using Mac OSX and would like to have MySQL in that. How do I access MySQL OSX Mac terminal remote connect. Please do the needful for providing me the step by step instructions on having terminal remote connect to MySQL.

Thanks in Advance,

Erskine Well

SHARE
Answered By 50 points N/A #169167

MySQL OSX Mac terminal remote connect

qa-featured

Hi Erskine

The MySQL Master role is available on port 22/ssh only from remote by default. You could create an SSH tunnel connecting the DB master with your local machine which will forward your packets to the remote MySQL instance over an encrypted SSH tunnel.

You require access to SSH for the DB instance in order for this to work and also download the SSH key. Once done, you can create the tunnel like below:

ssh -i .ssh/id_scalarium_yourkey -g -N -L 53306:localhost:3306 [email protected]

Where .ssh/id_scalarium_yourkey is the path to the downloaded SSH key, 46.51.109.79 is the external IP address of the database server. Once the SSH tunnel is set, the command line will hang. Keep this terminal window open.

You are able to connect now to the remote MySQL database by connecting to localhost on port 53306 (instead of the default port 3306). E.g. with the mysql cli:

Mysql –port=53306 –user=root –host=127. 0.0.1 -p

Login/Register to Answer

Related Questions