[Linux] SSH tunnel local port forwarding access to database in remote service


When there is no database service installed in my local area, I can directly access the database service on the remote machine through my local port, so that I can use the local forwarding function

Actually test the local port forwarding, forward the local 9006 port to the remote server’s port 3306 of, of course, you need to enter the user name and password of the remote machine

ssh -L 9006: [email protected]

After execution, you can use netstat command in another terminal to check the local 9006 port for listening, and then directly use MySQL command to connect to 9006 port to access the 3306 database of the remote machine. Of course, there is also remote forwarding. Forwarding the port of the remote machine to my local can facilitate debugging projects

My online video course address: