Preface In some cases, we only know the intranet address of the database and cannot connect through the intranet, but we can log in to other machines in the same intranet, and these machines can access the database in the intranet, then we can access the database through the ssh tunnel method. usage The usage of ssh tunnel is very simple, the specific format is as follows: ssh -L [local port]:[remote host]:[remote port] [username]@[remote host] Use the practice Assume that the intranet IP of our MySQL server is 10.86.22.22 and is enabled on port 3306. The external IP of another server in the same intranet as MySQL is 121.43.23.12. First execute locally: $ ssh -f -N -L 12345:121.43.23.12:3306 [email protected] Then execute locally: $ mysql -u root -P 12345 -h 127.0.0.1 -p After entering the password, you can log in to MySQL. After the execution is complete, we can use ps to find the sshd connection that was just established, and then kill it to close the ssh tunnel that was just established. Summarize The above is the full content of this article. I hope that the content of this article can be of some help to your study or work. If you have any questions, you can leave a message to communicate. You may also be interested in:
|
<<: Summary of Vue 3 custom directive development
>>: Example of how to build a Mysql cluster with docker
In CSS3, the transform function can be used to im...
Command: mysqlhotcopy This command will lock the ...
MySQL is an open source, small relational databas...
Table of contents Written in front Two-way encryp...
Table of contents Overview 1. useState 1.1 Three ...
Let’s not waste any more time and get straight to...
Solve the problem of not being able to access the...
Table of contents 1. Discover the problem 2. Dele...
Chinese documentation: https://router.vuejs.org/z...
1. How to install? 1. [Run] -> [cmd] to open t...
In the official MySQL dump tool, how can I restor...
Docker supports running on the following CentOS v...
illustrate: Root and alias in location The root d...
Table of contents summary Problem Description Ana...
This article shares the specific code of JavaScri...