Recently I updated the PHP version. When using the mysql_connect () function, an error is returned:
PHP Warning: mysql_connect (): mysqlnd cannot connect to MySQL 4.1 + using the old insecure authentication. please use an administration tool to reset your password with the command set password = PASSWORD ('your _ existing_password '). this will store a new, and more secure, hash value in mysql. user. if this user is 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 in/root/test. php on line 3
Cause:
To be compatible with versions earlier than MySQL 5.0, the user password (password field in the user table of mysql database) stores the 16-bit hash value of the password, the mysql driver after PHP5.3 uses the 41-bit password hash value for user verification. Therefore, you need to have mysql save the 41-bit hash value of the user password, but in the configuration file, if old_passwords = 1, the password () function can return only 16-bit hash values.
The solution is as follows:
SET old_passwords = 0; UPDATE mysql. user set password = PASSWORD ('phpddt. com ') WHERE User = 'root' LIMIT 1; select length (PASSWORD) FROM mysql. user WHERE User = 'root'; flush privileges;