Use this file to discover all available pages before exploring further.
You can run TiDB locally using three methods. TiUP Playground is the recommended approach because it manages the full cluster lifecycle automatically. Docker is the fastest way to get a single-node instance running. Building from source gives you the most control and is suitable if you are contributing to TiDB.
TiUP Playground (recommended)
Docker
Build from source
TiUP is TiDB’s official component manager. The tiup playground command starts a complete local TiDB cluster including TiDB, TiKV, and PD with a single command.
1
Install TiUP
Run the TiUP installer script:
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
After installation, reload your shell profile so the tiup binary is on your PATH:
source ~/.bashrc# or on macOSsource ~/.zshrc
2
Start the playground cluster
Launch a local TiDB cluster:
tiup playground
TiUP downloads the required components on first run, then starts TiDB on port 4000 and the status API on port 10080. The output shows the connection details once the cluster is ready.To pin a specific TiDB version:
tiup playground v8.1.0
Add --db 2 or --kv 3 flags to start multiple TiDB or TiKV instances for a more realistic multi-node setup.
3
Connect to TiDB
Open a new terminal and connect using any MySQL-compatible client:
mysql -h 127.0.0.1 -P 4000 -u root
No password is set by default on a fresh playground cluster.
Run a single TiDB server node using the official Docker image. This starts TiDB with the built-in unistore storage engine — suitable for development and testing but not for production workloads that require TiKV.
The pingcap/tidb Docker image uses unistore as its storage engine by default. This is an in-process store intended for testing. For a full distributed cluster with TiKV, use TiUP Playground or TiDB Operator on Kubernetes.
Build the tidb-server binary directly from the source repository. You need Go installed to compile TiDB.
1
Install prerequisites
Install Go 1.21 or later from go.dev/dl. Verify the installation:
go version
Install make and git if they are not already available on your system.