Skip to content

Instantly share code, notes, and snippets.

@T29H
Last active November 12, 2025 02:53
Show Gist options
  • Save T29H/1118b34cc7ac506f862d17972960aa13 to your computer and use it in GitHub Desktop.
Save T29H/1118b34cc7ac506f862d17972960aa13 to your computer and use it in GitHub Desktop.
How to connect Database to IntelliJ using SSH

πŸ’» Connecting Database to IntelliJ IDEA


Step 1: Configure the Database Connection

  1. Open Database view in IntelliJ (View β†’ Tool Windows β†’ Database).

  2. Click + β†’ Data Source β†’ MySQL (or your database type).

  3. Fill in the following connection details:

    Field Value
    Host db_private_IP
    Port db_port
    Authentication User & password
    User db_username
    Password db_password

Step 2: Configure SSH Tunnel

  1. In the same Data Source Properties window, go to the SSH/SSL tab.

  2. Enable Use SSH tunnel.

  3. Click ... (Edit) to create a new SSH configuration.

  4. Fill in the following SSH details:

    Field Value
    Host public_IP
    Port public_port
    User Create a ssh user ssh_username
    Authentication type Key pair (OpenSSH or PuTTY)
    Private key file Any private key file e.g. .ppk
  5. Click OK to save the SSH configuration.


Step 3: Test the Connection

  1. Back in the main Data Source window, click Test Connection.
  2. Wait for IntelliJ to confirm a successful connection.
  3. If successful, click Apply and OK to save the configuration.

Tips:
To avoid mixing up environments, use different color schemes or naming labels for staging and production connections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment