[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:


Recommended Today

Talk about the four classic applications of multithreading

Hello task, let’s meet again!! In the previous three simple articles, we have learned about the creation, operation, blocking, waiting, cancellation, delayed operation, asynchronous method and other related knowledge points of multithreading. Through these introductions, now we can write a multithreaded event in minutes. If you need to read the first three rows of articles, […]