作者:zhanhailiang 日期:2015-01-01
MySQL Native Driver简称mysqlnd,作为libmysqlclient替代品于PHP5.3.0版本引入。之前,MySQL数据库扩展mysql,mysqli,PDO MYSQL都是通过libmysqlclient实现与MySQL Server的通信。引入mysqlnd,这三个扩展都可以通过mysqlnd实现与MySQL Server的通信。
优点
- mysqlnd更容易编译;因为它是php源码树的一个组成部分;而基于libmysqlclient编译,意味着需要在本地安装MySQL;
- mysqlnd和php内部机制结合更紧密,是优化过的mysql驱动;
- mysqlnd更节省内存,从测试结果来看,比传统的mysql扩展节省40%的内存;
- mysqlnd更快;
- mysqlnd提供了丰富的性能统计功能;
- mysqlnd通过MySQL Native Driver Plugin API特性来充当MySQL Proxy,实现负载均衡,监控和性能优化
- mysqlnd使用了PHP license以避免不必要的版权纠纷;
安装
./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
测试
[[email protected]/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 $
更多阅读
时间: 2024-10-22 14:19:49