TiDB is a distributed HTAP database compatible with the MySQL protocol

go get



What is TiDB?

TiDB is a distributed SQL database. Inspired by the design of Google F1, TiDB supports the best features of both traditional RDBMS and NoSQL.

  • Horizontal scalability
    Grow TiDB as your business grows. You can increase the capacity simply by adding more machines.

  • Asynchronous schema changes
    Evolve TiDB schemas as your requirement evolves. You can add new columns and indices without stopping or affecting the on-going operations.

  • Consistent distributed transactions
    Think TiDB as a single-machine RDBMS. You can start a transaction that acrosses multiple machines without worrying about consistency. TiDB makes your application code simple and robust.

  • Compatible with MySQL protocol
    Use TiDB as MySQL. You can replace MySQL with TiDB to power your application without changing a single line of code in most cases.

  • Written in Go
    Enjoy TiDB as much as we love Go. We believe Go code is both easy and enjoyable to work with. Go makes us improve TiDB fast and makes it easy to dive into the codebase.

  • Multiple storage engine support
    Power TiDB with your most favorite engines. TiDB supports most of the popular storage engines in single-machine mode. You can choose from goleveldb, LevelDB, RocksDB, LMDB, BoltDB and even more to come.


TiDB is at its early age and under heavy development, some of the features mentioned above have not been fully implemented.

Please do not use it in production.


Read the Roadmap.

Quick start


Go environment. Currently a 64-bit version of go >= 1.5 is required.

go get -d
cd $GOPATH/src/

Run command line interpreter

Interpreter is an interactive command line TiDB client. You can just enter some SQL statements and get the result.

make interpreter
cd interpreter && ./interpreter

Press Ctrl+C to quit.

Run as go library

See for detailed instructions to use TiDB as library in Go code.

Run as MySQL protocol server

make server
cd tidb-server && ./tidb-server

In case you want to compile a specific location:

make server TARGET=$GOPATH/bin/tidb-server

The default server port is 4000 and can be changed by flag -P <port>.

Run ./tidb-server -h to see more flag options.

After you started tidb-server, you can use official mysql client to connect to TiDB.

mysql -h -P 4000 -u root -D test

Run as MySQL protocol server with distributed transactional KV storage engine

Comming soon.




Contributions are welcomed and greatly appreciated. See for details on submitting patches and the contribution workflow.

Follow us

Twitter: @PingCAP


TiDB is under the Apache 2.0 license. See the LICENSE file for details.


Travis Build Satus

TiDB Build Status

mybatis Build Status

sqllogictest-select Build Status

sqllogictest-expr Build Status

sqllogictest-aggregates Build Status

sqllogictest-groupby Build Status

sqllogictest-index-orderbynosort Build Status

sqllogictest-index-commute Build Status

sqllogictest-index-delete Build Status

sqllogictest-index-between Build Status

sqllogictest-index-in Build Status

sqllogictest-index-orderby Build Status

sqllogictest-select-1 Build Status

sqllogictest-expr-1 Build Status

sqllogictest-aggregates-1 Build Status

sqllogictest-groupby-1 Build Status

sqllogictest-index-orderbynosort-1 Build Status

sqllogictest-index-orderbynosort-2 Build Status

sqllogictest-index-orderbynosort-3 Build Status

sqllogictest-index-orderbynosort-4 Build Status

sqllogictest-index-commute-1 Build Status

sqllogictest-index-commute-2 Build Status

sqllogictest-index-commute-3 Build Status

sqllogictest-index-commute-4 Build Status

sqllogictest-index-commute-5 Build Status

sqllogictest-index-commute-6 Build Status

sqllogictest-index-random-1 Build Status

sqllogictest-index-random-2 Build Status

sqllogictest-index-random-3 Build Status

sqllogictest-index-random-4 Build Status

sqllogictest-index-random-5 Build Status

sqllogictest-index-random-6 Build Status

sqllogictest-index-between-1 Build Status

sqllogictest-index-between-2 Build Status

sqllogictest-index-between-3 Build Status

sqllogictest-index-between-4 Build Status

sqllogictest-index-between-5 Build Status

sqllogictest-index-in-1 Build Status

sqllogictest-index-in-2 Build Status

sqllogictest-index-in-3 Build Status

sqllogictest-index-in-4 Build Status

sqllogictest-index-in-5 Build Status

sqllogictest-index-delete-1 Build Status

sqllogictest-index-delete-2 Build Status

sqllogictest-index-delete-3 Build Status

sqllogictest-index-delete-4 Build Status

sqllogictest-index-delete-5 Build Status

sqllogictest-index-delete-6 Build Status

sqllogictest-index-delete-7 Build Status

sqllogictest-index-orderby-1 Build Status

sqllogictest-index-orderby-2 Build Status

sqllogictest-index-orderby-3 Build Status

sqllogictest-index-orderby-4 Build Status