PHP uses MYSQLND to deal with some problems caused by

Source: Internet
Author: User
Tags fpm

CentOS 5.11 is still using the older MySQL 5.0.59 server version, and PHP is also using the highest and 5.3.3 (using yum-y install PHP53 installation). From the official view the last version of 5.3 is 5.3.29 has been discontinued in August 2014, some bugs and security issues will not be repaired, so we decided to upgrade the version of PHP to 5.5. In the installation we use

./configure--prefix=/data/php.5.5.26--with-bz2--with-curl--enable-ftp--enable-sockets--disable-ipv6--with-gd  --with-iconv-dir=/data/libiconv--enable-mbstring--enable-calendar--with-gettext--with-zlib--with-mcrypt-- With-pdo-mysql=mysqlnd--with-mysqli=mysqlnd--with-mysql=mysqlnd--enable-dom--enable-xml--enable-fpm--with-fpm- -user=www--group=www
you can see that we used the MYSQLND as the driver to connect to the database. There are some problems that can occur during the testing process.

    • Time to deploy code to the test server appears no such file or directory, check nginx log appears PHP message:php warning:mysql_connect (): No such file or directory 。 After checking that the original is MYSQLND connection not to the database, modify the PHP configuration file Mysql.default_socket =/var/lib/mysql/mysql.sock Note My side is yum installed MySQL server, Restart the PHP-FPM. If you are using Apache, then start the Apache service.


    • Use mysql_connect (' localhost ', ' root ', ' 123 ') to find the server and error
      Mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Administration tool to reset your password with the command SET password = password (' Your_existing_password ' ). This would store a new, and more secure, the hash value in Mysql.user. If This user was used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from Your my.cnf file


      when using MYSQLND, there is a place to be aware of. The password format for the server is not to use the old 16-bit storage format, but to use the new 41-bit storage format

mysql> Select User,length (password) from mysql.user;+----------+------------------+| User     | length (password) |+----------+------------------+| root     |               16 | | Test     |               |+----------+------------------+2 rows in Set (0.00 sec)
First, change the configuration file of the database/etc/my.conf
under [mysqld] Check to see if there are
[Mysqld]
Old_passwords=1

change it to
old_passwords=0
If there is no new, then restart the database service

Second, change the password of the database

Update Mysql.user set Password=password (' 123456 ') where user= ' root '; update mysql.user set Password=password (' 123456 ') where user= ' test '; flush privileges;   mysql> Select User,length (password) from mysql.user;+--------------+------------------+| User         | length (password) |+--------------+------------------+| root         |               41 | | Test         |               41 | +--------------+------------------+  This change password to see how many users you have used.
Refresh the webpage again, normal.

PHP uses MYSQLND to deal with some problems caused by

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.