Connect to remote DB via ssh tunneling
The DB you want to connect to is on a remote server and cannot be accessed directly from the outside, but you do have ssh access to the remote server.
Solution
First, open a terminal window and run the following command (keep it open while you want to maintain the connection to the DB):
ssh -L localhost:<local_port>:<remote_db_host>:<remote_db_port> <remote_ssh_user>@<remote_ssh_host> [-i <permission_file>.pem]
Then, you connect to the DB at localhost:<local_port>
and the remote DB credentials.
We transform challenges into digital experiences
Get in touch to let us know what you’re looking for. Our policy includes 14 days risk-free!
Free project consultation