This page shows you how to connect to your CockroachCloud Free (beta) cluster.
CockroachCloud Free is currently in beta. For information about its limitations, see CockroachCloud Free (beta) FAQs.
Before you start
- Create a free cluster.
- (Optional) Create a new SQL user.
Step 1. Select a connection method
In the top right corner of the CockroachCloud Console, click the Connect button.
The Connection info modal displays on the Step 2. Connect > Command Line subtab.
(Optional) To configure your connection information, click Go Back:
- Select the SQL User you want to connect with.
- Select the Database you want to connect to.
- Click Next.
Select a connection method (the instructions in Step 2 below will adjust accordingly):
Step 2. Connect to your cluster
To connect to your cluster with the built-in SQL client:
Click the name of the
cc-ca.crt
to download the CA certificate to your local machine.Alternatively, you can set
sslmode=require
. This is less secure than using a CA certificate and should not be used with sensitive data.Create a
certs
directory on your local machine:$ mkdir certs
Move the downloaded
cc-ca.crt
file to thecerts
directory:$ mv /path/to/cc-ca.crt /path/to/certs
For example:
$ mv /Users/maxroach/Downloads/cc-ca.crt /Users/maxroach/certs
If you have not done so already, install the CockroachDB binary.
Copy the
cockroach sql
command and connection string provided in the Console, which will be used in the next step (and to connect to your cluster in the future).In your terminal, enter the copied
cockroach sql
command and connection string to start the built-in SQL client.Be sure to replace the
<your_certs_ directory>
placeholder with the path to thecerts
directory you created earlier.Enter the SQL user's password and hit enter.
Note:If you forget your SQL user's password, a Console Admin can change the password on the SQL Users page.
You are now connected to the built-in SQL client, and can now run CockroachDB SQL statements.
To connect to your cluster with your application, use the connection string provided in the Console::
- Click the name of the
cc-ca.crt
to download the CA certificate to your local machine. Create a
certs
directory on your local machine:$ mkdir certs
Move the downloaded
cc-ca.crt
file to thecerts
directory:$ mv /path/to/cc-ca.crt /path/to/certs
For example:
$ mv /Users/maxroach/Downloads/cc-ca.crt /Users/maxroach/certs
Copy the connection string provided in the Console, which will be used to connect your application to CockroachCloud Free (beta).
Add your copied connection string to your application code.
Be sure to replace the
<your_certs_ directory>
placeholder with the path to thecerts
directory you created earlier.Note:If you forget your SQL user's password, a Console Admin can change the password on the SQL Users page.
For examples, see the following:
To connect to your cluster with a CockroachDB-compatible tool, use the connection parameters provided in the Console.