MySQL Proxy and mysqlproxy
Author: zhanhailiang Date:
MySQL Native Driver (mysqlnd) is introduced as a substitute for libmysqlclient in PHP5.3.0. Previously, MySQL database extensions mysql, mysqli, and pdo mysql All communicate with MySQL Server through libmysqlclient. Mysqlnd is introduced. All three extensions can communicate with MySQL Server through mysqlnd.
Compared with libmysqlclient, the communication principle is as follows:
Advantages
- Mysqlnd is easier to compile because it is an integral part of the php source code tree. Compiling Based on libmysqlclient means that MySQL needs to be installed locally;
- The internal mechanism of mysqlnd and php is more closely integrated and is the optimized mysql driver;
- Mysqlnd saves more memory. From the test results, it saves 40% of memory than the traditional mysql expansion;
- Mysqlnd is faster;
- Mysqlnd provides a wealth of Performance Statistics functions;
- Mysqlnd acts as a MySQL Proxy through the MySQL Native Driver Plugin API feature to achieve load balancing, monitoring and performance optimization
- Mysqlnd uses PHP license to avoid unnecessary copyright disputes;
Install
./configure --prefix=/usr/local/php-5.3.29-production --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --enable-fpm --enable-mysqlndmake && make install
Test
[root@/usr/local]# /usr/local/php-5.3.29-production/bin/php -ini|grep mysqlndConfigure 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 $mysqlndmysqlnd => enabledVersion => mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325 $Client API version => mysqlnd 5.0.8-dev - 20102224 - $Id: 731e5b87ba42146a687c29995d2dfd8b4e40b325 $
Read more
- Mysqlnd
- Mysqlnd plugins