MySQL Native Driver簡稱mysqlnd,作為libmysqlclient替代品於PHP5.3.0版本引入。之前,MySQL數據庫擴展mysql,mysqli,PDO MYSQL都是通過libmysqlclient實現與MySQL Server的通信。引入mysqlnd,這三個擴展都可以通過mysqlnd實現與MySQL Server的通信。
其較libmysqlclient的通信原理對比如下圖:
./configure --prefix=/usr/local/php-5.3.29-production --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --enable-fpm --enable-mysqlnd make && make install
[root@/usr/local]# /usr/local/php-5.3.29-production/bin/php -ini|grep mysqlnd Configure Command => './configure' '--prefix=/usr/local/php-5.3.29-production' '--with-pear' '--with-iconv=/usr/local/' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-openssl' '--with-libxml-dir' '--with-curl' '--with-pdo-mysql=mysqlnd' '--disable-fileinfo' '--enable-fpm' '--enable-mysqlnd' '--with-mcrypt' '--enable-mbstring' Client API version => mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325 $ Client API library version => mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325 $ mysqlnd mysqlnd => enabled Version => mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325 $ Client API version => mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325 $