Connecting To A Database
Connecting to your database from Beekeeper Studio is easy. You can connect to a database in a few different ways:
- For SQLite databases, you can simply double click the file in your file browser
- For other databases, you can specify host & port, or the unix socket path.
- 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
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.
TCP (Host/Port) connection example
Note that SSL, SSH, and other advanced connection options are only available with a TCP connection.
SSL
Beekeeper Studio's SSL Configuration
There are three ways to connect to a database with SSL
- Trust the server: Connect with SSL without providing your own certificate. This is the default.
- Required Cert: Connect with SSL, provide your own certs, and disable
rejectUnauthorized
. - 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
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
:
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
Yes, the
+
is intentionalClient Configuration Options
Beekeeper supports tunneling your connection via SSH. To connect to a remote database using your SSH account on that machine:
-
Activate the SSH Tunnel to reveal the ssh connection detail fields
-
Enter the SSH Hostname or IP address of the remote SSH server
-
Change the SSH server's Port if it doesn't accept connections on the default port 22
-
Enter Bastion Host (JumpHost) (optional) if your server's network requires that you connect through a JumpHost
-
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 -
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
-
-
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
-
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
oropen ./example.db
- Linux:
xdg-open postgresql://user@host/database
orxdg-open ./example.db