PDO::__construct(): Premature end of data

I have a local version of php/yii connecting to an external MySQL server. All is well on the server, but hitting the application locally comes up with:


PDO::__construct(): Premature end of data (mysqlnd_wireprotocol.c:554) 

From some reading this has to do with the external mysql server using old_password, I don’t want to play around with the settings on the server so I’m trying to get my local machine to play nice. Is there a yii or php setting that will enable me to connect to the server that uses old_password?

Line 389 is highlighted in the error:


377      * @since 1.0.4

378      */

379     protected function createPdoInstance()

380     {

381         $pdoClass='PDO';

382         if(($pos=strpos($this->connectionString,':'))!==false)

383         {

384             $driver=strtolower(substr($this->connectionString,0,$pos));

385             if($driver==='mssql' || $driver==='dblib')

386                 $pdoClass='CMssqlPdoAdapter';

387         }

388         return new $pdoClass($this->connectionString,$this->username,

389                                     $this->password,$this->_attributes);

390     }

391 

392     /**

393      * Initializes the open db connection.

394      * This method is invoked right after the db connection is established.

395      * The default implementation is to set the charset for MySQL and PostgreSQL database connections.

396      * @param PDO $pdo the PDO instance

397      */

398     protected function initConnection($pdo)

399     {

400         $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

401         if($this->emulatePrepare && constant('PDO::ATTR_EMULATE_PREPARES'))



What PHP and MySQL version do you use…

PHP 5.3.x necessitates the use of the newer password format - http://www.php.net/manual/en/migration53.incompatible.php

PHP 5.3.4 the MySQL version of the hosted server is 5.0.32

So… as I wrote you in the post before… PHP 5.3 cannot work with MySql old password format…check the link I gave you…

Thanks, I turned off old_password on the server and re-set my password and all is well. Thanks again!

I have the same issue. But I have checked the MySQL server and see that "old-passwords" is OFF. But I am still unable to connect.

MySQL 5+, PHP 5.3+

If you made that change, you need to restart mysql first… and then re-set the password…

If that is not the problem… do you get the same error as in the first post?