Skip to content

Connecting To A Database

Connecting to your database from Beekeeper Studio is easy. You can connect to a database in a few different ways:

  1. For SQLite databases, you can simply double click the file in your file browser
  2. For other databases, you can specify host & port, or the unix socket path.
  3. Some cloud vendors support connecting with custom authentication methods, Beekeeper Studio supports many of these too (eg: SSO for Azure SQL).

First Step: Select Connection Type

When you open Beekeeper Studio for the first time, you'll see the connection screen. You can select the type of connection you want to make from the dropdown.

You can also import a database URL here, this is super useful for Heroku Postgres, Azure SQL, and other cloud databases.

Optional: Explore The Demo Database

Every new Beekeeper Studio installation comes with a Demo Database in the right side menu. This is a small SQLite database we bundle with the app. You can use this to explore Beekeeper Studio's features without connecting to a real database.

Complete

Image Alt Tag
The Beekeeper Studio Connection Screen

Connection Mode

You can connect to some databases with either a socket or a TCP connection. Socket connections only work when the database server is running on your local machine (it's the default set-up for a MySQL installation for example). TCP connections require a hostname and port.

Image Alt Tag

TCP (Host/Port) connection example

Note that SSL, SSH, and other advanced connection options are only available with a TCP connection.

SSL

Image Alt Tag

Beekeeper Studio's SSL Configuration

There are three ways to connect to a database with SSL

  1. Trust the server: Connect with SSL without providing your own certificate. This is the default.
  2. Required Cert: Connect with SSL, provide your own certs, and disable rejectUnauthorized.
  3. Verified Cert: Connect with SSL, provide your own certs, and enable rejectUnauthorized.

Here's a table of how the various sslmode flags from command line clients map to Beekeeper:

sslmode Turn on SSL? rejectUnauthorized
disable no n/a
allow no n/a
prefer no n/a
require yes false
verify-ca yes false
verify-full yes true

You can provide your own custom certificate files if needed.

SSH

Image Alt Tag

Beekeeper Studio's SSH configuration

Server Configuration

Before you can use an SSH tunnel to connect to your database, you need to make sure your SSH server is setup correctly.

Firstly make sure the following line is set in your /etc/ssh/sshd_config:

AllowTcpForwarding yes

ssh-rsa public keys

If you are using an ssh key generated by the ssh-rsa algorithm, you'll need to enable support for this algorithm in your ssh server.

To do this, you can add the following line to the /etc/ssh/sshd_config file on your SSH server

PubkeyAcceptedKeyTypes +ssh-rsa

Yes, the + is intentional

Client Configuration Options

Beekeeper supports tunneling your connection via SSH. To connect to a remote database using your SSH account on that machine:

  1. Activate the SSH Tunnel to reveal the ssh connection detail fields

  2. Enter the SSH Hostname or IP address of the remote SSH server

  3. Change the SSH server's Port if it doesn't accept connections on the default port 22

  4. Enter Bastion Host (JumpHost) (optional) if your server's network requires that you connect through a JumpHost

  5. Enter the Keepalive Interval (optional) to specify, in seconds, how often to ping the server while idle to prevent getting disconnected due to a timeout. This is equivalent to the ServerAliveInterval option you might use on the ssh command line, or in your ~/.ssh/config file -- Entering 0 (zero) disables this feature

  6. Select your SSH Authentication method:

    • SSH Agent if your local machine is running an SSH Agent, you only need to provide the remote SSH Username of your ssh account on the server

    • Username and Password to enter both your SSH Username and SSH Password (also see the Save Passwords option, below)

    • Key File Select your SSH Private key File (and optionally enter your Key File PassPhrase) if you use your SSH Public Key on the server for authentication

  7. Enter a name for your Connection (optionally check the Save Passwords checkbox) and Press Save to have Beekeeper remember all of the above for you

  8. Press the Connect button to access your database!

File Associations

Beekeeper Studio provides file associations so you can do the following things without opening the app:

  • Double click a sqlite .db file in a file browser to open it in Beekeeper Studio!
  • Open URLs and files from the terminal:
  • Mac: open postgresql://user@host/database or open ./example.db
  • Linux: xdg-open postgresql://user@host/database or xdg-open ./example.db