PHP 5.3 starts using MYSQLND as the default MySQL access driver

Source: Internet
Author: User

Mysqlnd becomes the default MySQL driver in PHP 5.3, and it has the following advantages:

    • Mysqlnd easier to compile: because it's a part of the PHP source tree
    • Mysqlnd and PHP internal mechanisms are more tightly coupled and are optimized for MySQL drivers
    • Mysqlnd saves more memory and, from test results, saves 40% of memory compared to traditional MySQL extensions
    • Mysqlnd faster
    • MYSQLND provides a wealth of performance statistics capabilities
    • MYSQLND uses PHP license to avoid unnecessary copyright disputes

This change should take effect for both MySQL and pdo_mysql extensions.

(PS) If you encounter this hint when using php5.3.x: "Mysqlnd cannot connect to MySQL 4.1+ using old authentication", That's because php5.3.x uses password to encrypt passwords instead of old_password. The Old_password is encrypted with a 16-bit string, and password is encrypted with a 41-bit string. Just use password to re-modify the password and make it effective.

What is MYSQLND?

Mysqlnd is MySQL's original PHP driver
Exam article: Http://forge.mysql.com/wiki/PHP_MYSQLND#A_brief_history_of_PHP.E2.80.99s_MySQL_APIs

Describes the process of MySQL growing in PHP ~

    • PHP ext/mysql:the-oldest extension and api-please don ' t use it any more, it does is not a support all MySQL features.
    • PHP 5+-ext/mysqli:the "current" extension and api-supports all features of MySQL
    • PHP 5+-pdo/mysql:an extension and Database API abstraction layer introduced with PHP 5

/ext/mysql/ext/mysqli/pdo/mysql are all written in C extension, also known as PHP API, these three are used Libmysql (MySQL Client Library).

Mysqlnd is not a new extension! Mysqlnd was it not a new api!

Mysqlnd is neither a new PHP extension nor a new api! MYSQLND is new C-level library code. The MYSQLND library provides almost the same functionality as Libmysql does. Both C-libraries Implement the MySQL communication protocol and can be used to connect to the MySQL Server.

However, Libmysql is a generic c-library with dual-licensing. Any c-based program can use it. As PHP is based in C, PHP is using it. MYSQLND is not a generic c-library. MYSQLND is licensed under the PHP license and it is tightly integrated to PHP on the c-level. For example, MYSQLND is using the PHP memory management functions and network streams. Due to the close integration, it's difficult for other C programs and PHP to use the library. Any and C program this tries to use MYSQLND would need to link against large parts of PHP. Maybe this explains what is "native" and "for PHP" means.

The general meaning is that MYSQLND is a new library of functions, Libmysql has almost all of its functions, but MYSQLND is not a general-purpose library like Libmysql, it is a library written specifically for PHP, with the intrinsic management functions of PHP and some functions of the network stream.

Related Article

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.