From: Operating system: FreeBSD PHP version: 5.3.3 Package: PDO related Bug Type: Bug Bug description:Old password authentication with (PDO) MySQL native driver
Description: ------------ Some PHP legacy code no longer works with the 5.3.3 MYSQLND-enabled [1] PDO MySQL driver -- I got 2 warnings and an exception is raised: [07-Sep-2010 14:31:16] PHP Warning: PDO::__construct(): Premature end of data (mysqlnd_wireprotocol.c:554) in /my/path/to/php/auto/append.php on line xx [07-Sep-2010 14:31:16] PHP Warning: PDO::__construct(): OK packet 1 bytes shorter than expected in /my/path/to/php/auto/append.php on line xx Exception says that "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication." This is inconsistent with the behavior of the 5.3.3 MySQL extension built with MYSQLND support: I have even older PHP code that can connect to MySQL 4.1+ using the old insecure authentication scheme (!?) Go figure. Of course, reverting to the PDO MySQL driver w/ classic MySQL client library support works. [1] mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ Test script: --------------- <?php try { $dbh = new PDO($sql->dsn, $sql->username, $sql->password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (Exception $e) { /* ... */ } // failure ?> vs. <?php $dbh = mysql_pconnect( $mysql['hostname'], $mysql['username'], $mysql['password'] ); // success ?> Expected result: ---------------- Why does old password authentication still works with MYSQLND-enabled MySQL extension but not with MYSQLND-enabled PDO MySQL driver? Actual result: -------------- SQLSTATE[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 -- Edit bug report at http://bugs.php.net/bug.php?id=52799&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52799&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52799&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52799&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52799&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52799&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52799&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52799&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52799&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52799&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52799&r=support Expected behavior: http://bugs.php.net/fix.php?id=52799&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52799&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52799&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52799&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52799&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52799&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52799&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52799&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52799&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52799&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52799&r=mysqlcfg