The first time of this paper is to hit the water – replace MySQL remote connection with tunnel
Tunnel is an engineering building buried in the ground. It is a form of human using underground space. Tunnel can be divided into traffic tunnel, hydraulic tunnel, municipal tunnel and mine tunnel. –Source: Baidu Encyclopedia
Before debugging mysql, checking data and modifying data, the command line is not convenient. You always think of a remote account of Mysql to access the database. As time goes by, I have developed the habit of leaking out the 3306 port. I didn’t think of the security problem. Recently, under the guidance of the big guy, I came into contact with the way of the tunnel, and I think it’s very useful. Without disclosing the port number, I can view MySQL as freely as a remote connection, which is very useful. Now I share it.
First of all, there must be a tool like xshell, which can access the server through SSH and tunnel. This paper takes xshell as an example
Select session, right-click properties
After logging in to xshell, open the session window and select any session, right-click the property
View – > tunnel pane
After entering the account number and password to log in to the server, click
You can see that a box pops up at the bottom of the xshell, switches to the transfer rule, and you can see that the connection is successful
When it comes to MySQL visualization tools, I have to mention Navicat. I think Navicat is the best MySQL visualization tool I have ever used.
To continue, first open the Navicat tool, create a new connection, and fill in the corresponding IP address and port in the xshell tunnel before filling in
Note: the port of MySQL should be the same as the listening port when adding the tunnel, otherwise it cannot be connected.
MySQL connection user name and password fill in MySQL user name and password on the server, click OK, the connection is successful! Now you can operate the remote database just like the local database, which is very convenient.
Add: SSH login remote database
After the prompt of the community classmate @ Xu’s novel, you can also use the SSH function of Navicat to connect to the remote database. The specific operations are as follows:
SSH enter the account password of the server:
Enter the MySQL account and password of the server in the general window
It’s simpler than a tunnel.
The above is the sharing of this article.