Doc Menu

Connectors and APIs

Database Connectors provide connectivity to the TiDB server for client programs. APIs provide low-level access to the MySQL protocol and MySQL resources. Both Connectors and the APIs enable you to connect and execute MySQL statements from another language or environment, including ODBC, Java (JDBC), Perl, Python, PHP, Ruby and C.

TiDB is compatible with all Connectors and APIs of MySQL (5.6, 5.7), including:

Connect to TiDB using MySQL Connectors

Oracle develops the following APIs and TiDB is compatible with all of them:


  • To connect to TiDB using a MySQL Connector from MySQL 8.0, you must explicitly specify default-auth=mysql_native_password, because mysql_native_password is no longer the default plugin.

Connect to TiDB using MySQL C API

If you use C language programs to connect to TiDB, you can connect to libmysqlclient directly and use the MySQL C API. This is one of the major connection methods using C language, widely used by various clients and APIs, including Connector/C.

Connect to TiDB using third-party MySQL APIs

The third-party APIs are not developed by Oracle. The following table lists the commonly used third-party APIs:

AdaGNU Ada MySQL BindingslibmysqlclientSee MySQL Bindings for GNU Ada
CC APIlibmysqlclientSee Section 27.8, “MySQL C API”
C++Connector/C++libmysqlclientSee MySQL Connector/C++ Developer Guide
MySQL++libmysqlclientSee MySQL++ Web site
MySQL wrappedlibmysqlclientSee MySQL wrapped
Gogo-sql-driverNative DriverSee Mysql Go API
CocoaMySQL-CocoalibmysqlclientCompatible with the Objective-C Cocoa environment. See
DMySQL for DlibmysqlclientSee MySQL for D
EiffelEiffel MySQLlibmysqlclientSee Section 27.14, “MySQL Eiffel Wrapper”
Erlangerlang-mysql-driverlibmysqlclientSee erlang-mysql-driver
HaskellHaskell MySQL BindingsNative DriverSee Brian O'Sullivan's pure Haskell MySQL bindings
hsql-mysqllibmysqlclientSee MySQL driver for Haskell
Java/JDBCConnector/JNative DriverSee MySQL Connector/J 5.1 Developer Guide
LuaLuaSQLlibmysqlclientSee LuaSQL
.NET/MonoConnector/NetNative DriverSee MySQL Connector/Net Developer Guide
Objective CamlOBjective Caml MySQL BindingslibmysqlclientSee MySQL Bindings for Objective Caml
OctaveDatabase bindings for GNU OctavelibmysqlclientSee Database bindings for GNU Octave
ODBCConnector/ODBClibmysqlclientSee MySQL Connector/ODBC Developer Guide
PerlDBI/DBD::mysqllibmysqlclientSee Section 27.10, “MySQL Perl API”
Net::MySQLNative DriverSee Net::MySQL at CPAN
PHPmysql, ext/mysqlinterface (deprecated)libmysqlclientSee Original MySQL API
mysqli, ext/mysqliinterfacelibmysqlclientSee MySQL Improved Extension
PDO_MYSQLlibmysqlclientSee MySQL Functions (PDO_MYSQL)
PDO mysqlndNative Driver
PythonConnector/PythonNative DriverSee MySQL Connector/Python Developer Guide
PythonConnector/Python C ExtensionlibmysqlclientSee MySQL Connector/Python Developer Guide
MySQLdblibmysqlclientSee Section 27.11, “MySQL Python API”
RubyMySQL/RubylibmysqlclientUses libmysqlclient. See Section 27.12.1, “The MySQL/Ruby API”
Ruby/MySQLNative DriverSee Section 27.12.2, “The Ruby/MySQL API”
SchemeMyscshlibmysqlclientSee Myscsh
SPLsql_mysqllibmysqlclientSee sql_mysql for SPL
TclMySQLtcllibmysqlclientSee Section 27.13, “MySQL Tcl API”

Connector versions supported by TiDB

ConnectorConnector Version
Connector/C6.1.0 GA
Connector/C++1.0.5 GA
Connector/Net6.9.9 GA
Connector/Net6.8.8 GA
Connector/ODBC3.51 (Unicode not supported)