Manage your remote database locally with DataGrip

How to securely connect to your remote database using DataGrip

You may want to manage your remote databases from your local computer using a SQL client. The approach is quite similar regardless the particular client, but in this article we’ll use JetBrain’s DataGrip.

Once you have it installed, create a new Data Source for your MySQL database. You’ll have to set it up through three different tabs.

Tab “General”

Make sure your Driver is MySQL and provide the following inputs:

  • Host: 127.0.0.1
  • Port: 3306
  • User: Your database user – you can get this from Moss: ServerDatabases
  • Password: Password of your database user – you can get this from Moss: ServerDatabases
  • Database: Name of your database – you can get this from Moss: ServerDatabases

Tab “SSH/SSL”

In case you want to use SSH public key auth:

  • Check Use SSH tunnel
  • Proxy host: Your server’s public IP address – you can get this from Moss: ServerOverview
  • Proxy port: 22
  • Proxy user: The name of your server user (usually you don’t want to connect as a privileged user like moss) – you can get this from Moss: ServerServer Users
  • Auth type: Key pair (OpenSSH or PuTTY)
  • Private key file: Local path to the file that contains your SSH Private Key. Note that you must have uploaded the corresponding SSH Public Key on the server user above.
  • Passphrase: If your SSH Private Key’s protected with a passphrase, provide it here

Alternatively, in case you want to use SSH password auth:

  • Check Use SSH tunnel
  • Proxy host: Your server’s public IP address – you can get this from Moss: ServerOverview
  • Proxy port: 22
  • Proxy user: The name of your server user (usually you don’t want to connect as a privileged user like moss) – you can get this from Moss: ServerServer Users
  • Auth type: Password
  • Proxy password: Password of the server user – you can get this from Moss: ServerServer Users

Tab “Advanced”

  • serverTimezone: Provide the timezone of your server here