For security reasons, the database server is typically deployed only on the intranet, or if it is deployed on a public network, but only for certain designated IPs. But if the data is eventually queried by the public, there will always be a channel to access the database. The following uses Navicat and SECURECRT to achieve database access to two different scenarios.
Scenario One: The database server opens the SSH service on the public network
method One: Take advantage of navicat SSH tunnel
configuration in Navicat:
Host NAME/IP Address: Domain name or IP addresses of database servers port: Database port (e.g. mysql:3306) User name: Database connection username password: Database connection password
Tick "Use SSH tunnel" Host NAME/IP address: The domain name or IP address of the database server port:ssh port number (e.g.) User name:ssh username Password:ssh user's password tick "Save Password "Click "Test Connection" to connect successfully.
method Two: Using the port forwarding function of SecureCRT
SECURECRT Configuration:1. Create a new session, SSH connection to database server 2, session options, port forwarding, add ... Local-to-port: Enter a number between 1024~65535 to listen for local NAVICAT requests remote-port: Enter the port for the database service (such as mysql:3306)
navicat Configuration:
Host name/ip Address: Fill in Localhostport: Fill in securecrt "Local port" value User name: Database connection user name password: Database connection password Click "Test Connection" The connection was successful.
Scenario Two: Database Server C network, public network Server B open the SSH service, public network server can connect C, local machine a need to use Navicat connection CThe configuration method is similar to method two in scenario one, where it differs:
securecrt configuration:
Remote: Check "destination host differs from SSH server", hostname: Fill in C IP address
Use Navicat's SSH tunnel and SECURECRT port forwarding to connect a remote database server to which the native IP is blocked