Difference between revisions of "Port forward mysql on local network with SSH"
From DevOps Notebook
(Created page with "Run from server you wanna access to MySQL that is on private network<br> that is not in same network as we are. <pre> $ ssh -v -4 -N -L 3307:<sql_server_private_ip>:3306 root@...") |
(No difference)
|
Latest revision as of 12:26, 26 January 2022
Run from server you wanna access to MySQL that is on private network
that is not in same network as we are.
$ ssh -v -4 -N -L 3307:<sql_server_private_ip>:3306 root@<remote_host> $ mysql -h127.0.0.1 -p3307
If we wanna make connection persistent and auto reconnect:
$ autossh -M 0 -f -q -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" \ -L 3307:<sql_server_private_ip>:3306 root@<remote_host>