cockroach
TLDR
Start single-node cluster
$ cockroach start-single-node --insecure
Start SQL shell$ cockroach sql --insecure --host=[localhost]
Execute SQL statement$ cockroach sql --insecure -e "[SELECT * FROM users]"
Initialize cluster$ cockroach init --insecure --host=[localhost]
Show node status$ cockroach node status --insecure
Create database$ cockroach sql --insecure -e "CREATE DATABASE [mydb]"
Import data$ cockroach import into [table] CSV DATA ('[file.csv]')
Show cluster settings$ cockroach sql --insecure -e "SHOW CLUSTER SETTINGS"
SYNOPSIS
cockroach command [options]
DESCRIPTION
cockroach is the CLI for CockroachDB, a distributed SQL database. It manages cluster nodes, executes SQL, handles backups, and monitors cluster health.
PARAMETERS
--insecure
Disable TLS (development only)--host=address
Server address--port=port
Server port (default: 26257)--certs-dir=path
Certificate directory--store=path
Data storage location-e, --execute=sql
Execute SQL statement--url=url
Connection URL
COMMANDS
start
Start a CockroachDB nodestart-single-node
Start single-node clusterinit
Initialize multi-node clustersql
Open SQL shell or execute statementsnode
Manage cluster nodesquit
Drain and shut down nodedump
Export table data (deprecated, use EXPORT)cert
Create CA, node, and client certificatesversion
Show versiondemo
Start temporary demo cluster
ENVIRONMENT
Flags can be set via environment variables: COCKROACHHOST, COCKROACHPORT, COCKROACHUSER, COCKROACHINSECURE
CAVEATS
Use --insecure only for development. Production requires TLS certificates. Compatible with PostgreSQL wire protocol.


