CockroachDB CLI for running SQL, managing nodes and certificates, handling userfile storage, and collecting cluster diagnostics.
$brew install cockroachdb/tap/cockroach
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis
cockroach is the command line interface bundled with CockroachDB for starting nodes, connecting with a built-in SQL client, and running cluster administration or troubleshooting commands. It covers both day-to-day operator tasks and direct SQL access against local or remote CockroachDB clusters.
What It Enables
- Start or initialize self-managed clusters, open the built-in SQL client, or run non-interactive SQL and format results for follow-up shell processing.
- Inspect node membership and status, generate certificates, create or revoke web auth sessions, and move files through
userfilestorage from the terminal. - Download statement diagnostics bundles, build
debug zipsupport archives, and run low-level debug or recovery commands against cluster and store data.
Agent Fit
- Most client commands are non-interactive by default, and the shared
--formatflag exposes structured JSON or NDJSON output on SQL, node, auth, debug zip, and related table-printing commands. - Good fit for inspect-change-verify loops around an existing CockroachDB deployment because the same binary can query SQL state, check node health, stage files, and collect diagnostics.
- Mixed overall: a lot of value depends on having a reachable cluster plus credentials or TLS material, and
cockroach sql,demo, or secure setup flows can still become interactive.
Caveats
- Useful automation assumes a reachable CockroachDB node and the right connection settings, certificates, or admin privileges; several commands target system-level operations.
- This is a combined server and admin binary, so some subcommands are meant for operators or support workflows rather than general database scripting.