The database can only be connected to the intranet, but what should I do if a remote connection is required? Link mysql through SSH tunnel

The database can only be connected to the intranet, but what should I do if a remote connection is required? Link mysql through SSH tunnel

The company's new project is launched, and the project needs to be deployed to the cloud, and the operator's cloud host and cloud database have been purchased. But there is a problem. The cloud database can only be connected to the intranet, and cannot be directly connected to the database in the company. This feels too cumbersome to operate through the command line, and it is inconvenient to maintain. Then I thought of linking mysql through the SSH tunnel.

step

The database is a cloud database, and there is only an internal network ip, and only the cloud host can connect to the cloud database. If the company needs to connect to the cloud database locally, it needs to be connected through an ssh tunnel.

1. Open FinalShell and add basic ssh connection information.
insert image description here
2. Click Tunnel, click Add
insert image description here
3. Fill in relevant information

insert image description here

4. Click OK after filling in the information, and then connect to ssh
5. Open Navicat, fill in the link information
insert image description here
6. Click Test Connection
insert image description here
, so that you can connect to the intranet database through the cloud host.

Guess you like

Origin blog.csdn.net/javaXiaoAnRan/article/details/107447316