# `PHP` Connectors

+ **`PDO_MYSQL`**
  + It is based on `PDO (PHP Data Objects)`
  + **`PDO_MYSQL`** is a general database abstraction layer for `MySQL`
+ **`mysqli`**
  + It is specific for `MySQL`
  + Supports more `MySQL` specific features
  + When compiled with **`mysqlnd`**, supports non-blocking, asynchronous queries 

------------------------------------------------------------
There are two main MySQL APIs: `mysqli` (which is mysql "improved") and the more recent `PDO` extension. The performance of both these APIs is similar, but `mysqli` supports more MySQL features. It is recommended to use the `mysqli` or `PDO_MySQL` interface instead of the `mysql` interface.

Both `mysqli` and `PDO_MySQL` are PHP extensions that are lightweight wrappers on top of a C Client Library, either the `mysqlnd` library or the `libmysqlclient` library. Choosing a library is a compile-time decision.

The `mysqlnd` library has been part of the PHP distribution since 5.3.0. It offers features such as lazy connections and query caching. These features are not available with `libmysqlclient`, so using the built-in `mysqlnd` library is highly recommended.

The primary PHP website provides access to PHP distributions and documentation, including PDO documentation. PHP source distributions include PDO support, so you do not need to obtain it separately. However, you must enable PDO support for MySQL when you configure the distribution. If you use a binary distribution, be sure that it includes PDO MySQL support.

[`mysql_xdevapi`](https://www.php.net/manual/en/book.mysql-xdevapi.php) won't work with TiDB due to [missing support for X Protocol](https://github.com/pingcap/tidb/issues/1109).
