Use this file to discover all available pages before exploring further.
TiDB is MySQL-compatible and listens on port 4000. Once your cluster is running, you connect with any MySQL client and use standard SQL.
TiUP Playground (local)
Docker
Kubernetes
TiUP is PingCAP’s component manager. The playground command starts a single-node TiDB cluster on your laptop — no infrastructure required.
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 command is available:
source ~/.bashrc# or, on macOS with zsh:source ~/.zshrc
2
Start a local cluster
Launch a playground cluster with one TiDB node, one TiKV node, and one PD node:
tiup playground
TiUP downloads the required components on first run. When the cluster is ready you will see output similar to:
To connect TiDB: mysql --comments --host 127.0.0.1 --port 4000 -u root
To start a cluster with TiFlash for HTAP queries, add the --tiflash 1 flag: tiup playground --tiflash 1
3
Connect with a MySQL client
Open a new terminal and connect using the MySQL CLI:
mysql -h 127.0.0.1 -P 4000 -u root
The root user has no password by default in the playground environment.
Run a single TiDB Server node backed by an embedded unistore for local development.
The Docker single-node setup uses unistore (an in-process mock store) instead of TiKV. It is suitable for development and testing but does not provide the full distributed capabilities of a production cluster.
Once connected, run these SQL statements to create a sample schema and insert data. The example uses AUTO_INCREMENT for the primary key, which TiDB supports natively.
-- Create a databaseCREATE DATABASE myapp;USE myapp;-- Create a table with an AUTO_INCREMENT primary keyCREATE TABLE users ( id BIGINT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL UNIQUE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id));-- Insert rowsINSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com'), ('Bob', 'bob@example.com');-- QuerySELECT id, name, email, created_at FROM users;
Expected output:
+----+-------+-------------------+---------------------+| id | name | email | created_at |+----+-------+-------------------+---------------------+| 1 | Alice | alice@example.com | 2026-04-05 00:00:00 || 2 | Bob | bob@example.com | 2026-04-05 00:00:00 |+----+-------+-------------------+---------------------+