Skip to main content
This quickstart guide walks you through installing CockroachDB, starting a local cluster, and running your first SQL commands. You’ll have a working CockroachDB cluster in just a few minutes.

Before you begin

For production deployments, consider using CockroachDB Cloud for a fully managed experience.
This guide assumes you have basic familiarity with SQL databases and command-line interfaces.

Step 1: Install CockroachDB

Choose your operating system and follow the installation instructions:
Install CockroachDB using Homebrew:
brew install cockroachdb/tap/cockroach
Verify the installation:
cockroach version
For other installation methods, see Install CockroachDB on Mac.

Step 2: Start a single-node cluster

For quick testing and development, start a single-node cluster:
cockroach start-single-node --insecure --listen-addr=localhost
The --insecure flag disables all security features. Only use this for local testing, never in production.
You’ll see output indicating the cluster has started:
*
* WARNING: RUNNING IN INSECURE MODE!
*
* - Your cluster is open for any client that can access localhost.
* - Any user, even root, can log in without providing a password.
* - Any user, connecting as root, can read or write any data in your cluster.
*
CockroachDB node starting at 2026-03-03

Step 3: Use the SQL shell

Open a new terminal and connect to your cluster using the built-in SQL client:
cockroach sql --insecure --host=localhost:26257
You’ll see the SQL prompt:
root@localhost:26257/defaultdb>

Step 4: Run your first SQL commands

Let’s create a database, a table, and insert some data:
1

Create a database

CREATE DATABASE bank;
2

Use the database

USE bank;
3

Create a table

CREATE TABLE accounts (
  id INT PRIMARY KEY,
  balance DECIMAL
);
4

Insert data

INSERT INTO accounts VALUES (1, 1000.50);
INSERT INTO accounts VALUES (2, 2500.75);
5

Query the data

SELECT * FROM accounts;
You should see:
  id | balance
-----+---------
   1 | 1000.50
   2 | 2500.75
(2 rows)

Step 5: Access the DB Console

CockroachDB includes a web-based DB Console for monitoring your cluster:
  1. Open your browser and navigate to http://localhost:8080
  2. Explore the cluster overview, metrics, and database information
The DB Console provides real-time insights into your cluster’s health, performance, and resource usage.

Step 6: Stop the cluster

When you’re done, stop the cluster by pressing Ctrl+C in the terminal where CockroachDB is running. To remove the data directory:
rm -rf cockroach-data/

What’s next?

Now that you have CockroachDB running, explore these resources:

Start a local cluster

Run a multi-node cluster for testing replication and resilience

Build a sample app

Connect your application to CockroachDB

Learn CockroachDB SQL

Master the SQL syntax and features

Explore capabilities

See fault tolerance and distributed features in action

Build docs developers (and LLMs) love