Edit report at https://bugs.php.net/bug.php?id=64870&edit=1

 ID:                 64870
 Updated by:         u...@php.net
 Reported by:        marceloinxs at gmail dot com
 Summary:            mysqlnd: can't connect to updated MySQL server with
                     old_password Off
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Windows 7 64bit
 PHP Version:        5.4.15
 Block user comment: N
 Private report:     N

 New Comment:

Please, provide a Whireshark recording of the failed connection attempt. Thanks.


Previous Comments:
------------------------------------------------------------------------
[2013-05-27 17:20:26] marceloinxs at gmail dot com

old_passwords is a configuration variable/flag in the MySQL configuration file. 
It is set Off (as SHOW GLOBAL VARIABLES statement shows). I don't have admin 
privileges for the database and no possibility to change config values. But I 
can connect using a Linux server, so the problem seems to be enterily related 
with mysqlnd Windows driver.

------------------------------------------------------------------------
[2013-05-26 17:29:02] hanskrentel at yahoo dot de

> 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. 

You write "variable" here. The error message clearly directs you to the 
configuration file (which is *not* a variable).

Please check your configuration file and report back which related settings 
you've 
got in there.

------------------------------------------------------------------------
[2013-05-17 16:44:57] marceloinxs at gmail dot com

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 this bug report at https://bugs.php.net/bug.php?id=64870&edit=1

Reply via email to