Php5.5. * & #160; install the mysqlnd driver

Source: Internet
Author: User
1. What is the mysqlnd driver? Description in the PHP Manual: MySQLNativeDriverisareplacementfortheMySQLClientLibrary (libmysql). Alias is short for mysqlnativedriver, which is the mysql driver connection code provided by the PHP source code.

1. What is the mysqlnd driver? Description in the PHP Manual: MySQLNativeDriverisareplacementfortheMySQLClientLibrary (libmysql). Using mysqldnd is short for mysqlnativedriver, which is the mysql driver connection code provided by the PHP source code.

1. What is the mysqlnd driver?

Description in the PHP manual:

MySQL Native Driver is a replacement for the MySQL Client Library (libmysql ).

MySQL Native Driver is part of the official PHP sources as of PHP 5.3.0.


Mysqldnd is short for mysql native driver, which is the mysql driver connection code provided by the PHP source code. It aims to replace the old libmysql driver.

In the traditional php installation method, we usually need to specify the following items when compiling PHP:
-- With-mysql =/usr/local/mysql

-- With-pdo-mysql =/usr/local/mysql

This is actually using the libmysql driver officially provided by mysql. This is an old driver. We do not recommend using it since PHP 5.3, but we recommend using mysqlnd.

2. What is the relationship between PDO, mysqlnd, and libmysql?
PDO is an abstract class at the application layer. The connection between the underlying layer and the mysql server requires support from the mysql driver. That is to say, you can use PDO no matter what driver you use.

PDO provides PHP application layer API interfaces, while mysqlnd and libmysql are responsible for network protocol interaction with mysql server (it does not provide php application layer API functions)

3. Why the mysqlnd driver?
PHP official manual description:
A. The libmysql driver is written by mysql AB (now oracle) and published in accordance with the mysql license agreement. Therefore, it is disabled by default in PHP.

Mysqlnd is a driver officially developed by php. It is released using the php license agreement, so it avoids the license agreement and copyright issues.

B. because mysqlnd is built into the PHP source code, you do not need to install mysql server in advance when compiling and installing php. You can also provide mysql client APIs (mysql_connect, pdo, mysqli ), this will reduce the workload.

C. mysqlnd is a driver specially designed for php optimization. It uses the features of PHP and has better performance than libmysql in memory management. in the official php test, libmysql saves two copies of each record in the memory, while mysqlnd only saves one copy.

D. Some new or enhanced functions
Enhanced persistent connections
Introduce the unique function mysqli_fetch_all ()

Introduce some performance statistics functions mysqli_get_cache_stats (), mysqli_get_client_stats (),

Mysqli_get_connection_stats (),

Using the above functions, you can easily analyze the performance bottleneck of mysql queries!

SSL support (effective from php 5.3.3)

Compression protocol support

Support for named pipelines (effective from php 5.4.0)

4. You may be eager to use the mysqlnd driver. This section describes how to use the mysqlnd driver.
Tip: If you use mysqlnd, you do not need to install mysql in advance.

When compiling php, modify the following parameters:
-- With-mysql = mysqlnd \

-- With-mysqli = mysqlnd \

-- With-pdo-mysql = mysqlnd

Verification: if the client API Version: mysqlnd is found in the mysql output by phpinfo, The mysqlnd driver is successfully installed.

In addition, a php compilation parameter list that can be used in the production environment is provided.
./Configure -- prefix =/usr/local/php \

-- With-mysql = mysqlnd \

-- With-mysqli = mysqlnd \

-- With-pdo-mysql = mysqlnd

-- With-iconv-dir \

-- With-freetype-dir \

-- With-jpeg-dir \

-- With-png-dir \

-- With-zlib \

-- With-libxml-dir \

-- Enable-xml \

-- Disable-rpath \

-- Enable-bcmath \

-- Enable-shmop \

-- Enable-sysvsem \

-- Enable-inline-optimization \

-- With-curl \

-- With-mcrypt \

-- With-curlwrappers \

-- Enable-mbregex \

-- Enable-fpm \

-- Enable-mbstring \

-- With-gd \

-- Enable-gd-native-ttf \

-- With-openssl \

-- With-mhash \

-- Enable-pcntl \

-- Enable-sockets \

-- With-xmlrpc \

-- Enable-zip \

-- Enable-soap \

-- Without-pear

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.