Overview
This guide will walk you through starting a local CockroachDB cluster, connecting to it, and running your first SQL commands. You’ll have a working database in less than 10 minutes.This quickstart uses a single-node cluster for development and testing. For production deployments, see the Installation Guide.
Prerequisites
- A supported operating system (Linux, macOS, or Windows)
- At least 2GB of available RAM
- Terminal or command prompt access
Download CockroachDB
Download the latest CockroachDB binary for your platform:Verify the installation:
Start a Single-Node Cluster
Start CockroachDB in insecure mode (for development only):You should see output indicating the node is running:What’s happening:
start-single-node: Starts a single-node cluster (automatically initializes)--insecure: Runs without SSL/TLS (development only)--listen-addr: SQL and RPC connections address--http-addr: Admin UI address
Access the Admin UI
Open your browser and navigate to:The Admin UI provides:
- Cluster health and metrics
- Database and table information
- Query performance statistics
- Node details and topology
No authentication is required in insecure mode. For production, always use secure mode with proper certificates.
Open the SQL Shell
In a new terminal window, connect to the cluster using the built-in SQL client:You’ll see a welcome message:
Common SQL Shell Commands
The CockroachDB SQL shell supports special commands:Testing Distributed Transactions
Even in a single-node cluster, you can see CockroachDB’s transaction handling:Next Steps
Multi-Node Cluster
Start a local multi-node cluster to see replication in action
Production Installation
Deploy CockroachDB for production use
Build an App
Connect your application using client drivers
Learn SQL
Master CockroachDB SQL features and best practices
Stopping the Cluster
To stop the cluster:- In the terminal running CockroachDB, press
Ctrl+C - Wait for the graceful shutdown to complete
Troubleshooting
Port already in use
Port already in use
If ports 26257 or 8080 are already in use, specify different ports:
Connection refused
Connection refused
Ensure the cluster is running and you’re connecting to the correct host and port:
Out of disk space
Out of disk space
CockroachDB requires sufficient disk space. Check available space:Specify a custom store location if needed: