The Blog

Persistent connect to additional MySQL in a clever way. Posted on


# create ssh key
ssh-keygen

# copy ssh key to the mysql source server
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] -p 2222

# use this to test ssh connection
ssh [email protected] -p 2222

# here we make persistent connection to the source DB by changing DB port
ssh -fNg -L 3307:127.0.0.1:3306 [email protected] -p 2222

# and here we make the connection!
mysql -h 127.0.0.1 -P 3307 -u root -p some_db_on_source_server
This entry was posted in Uncategorized. Bookmark the permalink.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *



CAPTCHA
Change the CAPTCHA codeSpeak the CAPTCHA code