This is the implementation of the TiDB data handler for MindsDB.

TiDB is an open-source NewSQL database that supports Hybrid Transactional and Analytical Processing workloads. It is MySQL-compatible and can provide horizontal scalability, strong consistency, and high availability.


Before proceeding, ensure the following prerequisites are met:

  1. Install MindsDB locally via Docker or use MindsDB Cloud.
  2. To connect TiDB to MindsDB, install the required dependencies following this instruction.
  3. Install or ensure access to TiDB.


This handler is implemented by extending the MySQL data handler.

The required arguments to establish a connection are as follows:

  • user is the database user.
  • password is the database password.
  • host is the host name, IP address, or URL.
  • port is the port used to make TCP/IP connection.
  • database is the database name.


In order to make use of this handler and connect to the TiDB database in MindsDB, the following syntax can be used:

CREATE DATABASE tidb_datasource
  ENGINE = 'tidb',
    "host": "",
    "port": 4000,
    "database": "tidb",
    "user": "root",
    "password": "password"

You can use this established connection to query your table as follows:

FROM tidb_datasource.demo_table;