From:             marceloinxs at gmail dot com
Operating system: Windows 7 64bit
PHP version:      5.4.15
Package:          MySQLi related
Bug Type:         Bug
Bug description:mysqlnd: can't connect to updated MySQL server with 
old_password Off

Description:
------------
Windows 7 build 7601, Apache 2.2.24 (Win32). Upgraded PHP from 5.2.* to
5.4.15, mysql_* and mysqli_* can't connect to any databases. Then
downgraded to 5.3.25, same result. 

The error is always the same: 

PHP Warning:  mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]:
Premature end of data (mysqlnd_wireprotocol.c:553) 
PHP Warning:  mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]:
OK packet 1 bytes shorter than expected
PHP Warning:  mysqli::mysqli() [<a href='mysqli.mysqli'>mysqli.mysqli</a>]:
(HY000/2000): 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

The weird thing is that the database is actually MySQL 5.5.24, old_password
variable is Off and passwords are actually 41 byte encoded. 

The database is remote, but remote connections are allowed. I even tried
the same script in Linux based server (PHP 5.4.10) and it worked. 

Both mysql and mysqli extensions are correctly loaded in php.ini. 

The main difference between PHP 5.2 and newer versions is that they now use
mysqlnd as driver. Maybe it is buggy in Windows?

You can have an extended look of this here:
http://stackoverflow.com/questions/16598572/mysqlnd-cannot-connect-to-mysql-5-5-24-old-password-is-off


Test script:
---------------
<?php

$mysqli = new mysqli('aaa', 'bbb', 'ccc', 'ddd');
                
if($mysqli->connect_error) {
        die( $mysqli->connect_error );
}
                
echo 'connected';

?>

Expected result:
----------------
'connected'

Actual result:
--------------
Warning: mysqli::mysqli() [mysqli.mysqli]: Premature end of data
(mysqlnd_wireprotocol.c:553) in ... on line 3

Warning: mysqli::mysqli() [mysqli.mysqli]: OK packet 9 bytes shorter than
expected in ... on line 3

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2000): 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 ... on line 3

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

-- 
Edit bug report at https://bugs.php.net/bug.php?id=64870&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64870&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64870&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64870&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64870&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64870&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64870&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64870&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64870&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64870&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64870&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64870&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64870&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64870&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64870&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64870&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64870&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64870&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64870&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64870&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64870&r=mysqlcfg

Reply via email to