Port mapping is actually to convert a port of one of the network devices (a router, a computer or server) to another network device. The actual The above is a type of NAT address translation.
Recommended related mysql video tutorials: "mysql tutorial"
linuxThe port forwarding function implemented by the ssh connection command, in the explanation of port forwarding Before, let’s first understand the parameters of ssh command:
-f background authentication user/password, usually used in conjunction with -N, without logging in to the remote host;
-p The sshd service port of the logged-in ssd server;
-L forwards a certain port of the local machine (client) to the specified port of the remote specified machine. The working principle is as follows. A socket listening port is allocated on the local machine. Once there is a connection on this port, the connection is forwarded through the Secure channel, and at the same time the remote host and the host's hostport port are established. connect. Port forwarding can be specified in the configuration file. Only root can forward privileged ports;
-R forwards a port of the remote host (server) to the specified port of the local specified machine. The working principle is as follows. A socket listening port is allocated on the remote host. Once there is a connection on this port, the connection is redirected out through the secure channel, and a connection is established between the local host and the host's hostport port.
You can specify port forwarding in the configuration file. Only logging in to the remote host as root can forward privileged ports.
-C compresses data transmission.
-N does not execute scripts or commands. It is usually used with -f.
-g allows remote hosts to connect to the established forwarded port. If this parameter is not added, only The local host establishes a connection.
Open port 8080 of a certain host to port 8080 of the local host. Tunnel
ssh -N -L8080:localhost:80 Remote host
Now you can directly enter localhost:8080 in the browser to access this website
ssh -C -f -N -g -L list en_port:DST_Host:DST_port user@Tunnel_Host ssh -C -f -N -g -R listen_port:DST_Host:DST_port user@Tunnel_Host ssh -C -f -N -g -D listen_port user@Tunnel_Host
The password is the ssh root user password
Free mysql online video tutorial
2. 3.Boolean Education Yan Shiba mysql introductory video tutorial
The above is the detailed content of SSH tunnel external access MySQL tutorial. For more information, please follow other related articles on the PHP Chinese website!