5 Replies - 5286 Views - Last Post: 18 September 2012 - 01:48 PM

#1 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Question: Premature end of data (mysqlnd_wireprotocol.c:553)

Posted 18 September 2012 - 08:32 AM

Hey guys,
I am experiencing some problems with connecting to a remote database.Currently I am running WAMP with Apache 2.2.21, PHP 5.3.8, and MySql 5.5.16. These are some of the errors I am getting...

( ! ) Warning: mysql_connect() [function.mysql-connect]: Premature end of data (mysqlnd_wireprotocol.c:553) in C:\wamp\www\PHPExcel\Tests\phpexcelreader2beta.php on line 33
Call Stack
# Time Memory Function Location
1 0.0009 397632 {main}( ) ..\phpexcelreader2beta.php:0
2 19.8845 66398448 mysql_connect ( ) ..\phpexcelreader2beta.php:33

( ! ) Warning: mysql_connect() [function.mysql-connect]: OK packet 1 bytes shorter than expected in C:\wamp\www\PHPExcel\Tests\phpexcelreader2beta.php on line 33
Call Stack
# Time Memory Function Location
1 0.0009 397632 {main}( ) ..\phpexcelreader2beta.php:0
2 19.8845 66398448 mysql_connect ( ) ..\phpexcelreader2beta.php:33

( ! ) Warning: mysql_connect() [function.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 C:\wamp\www\PHPExcel\Tests\phpexcelreader2beta.php on line 33
Call Stack
# Time Memory Function Location
1 0.0009 397632 {main}( ) ..\phpexcelreader2beta.php:0
2 19.8845 66398448 mysql_connect ( ) ..\phpexcelreader2beta.php:33
Could not connectmysqlnd 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


Has anyone else experienced this problem. I read a couple of forums and one guy had this to say about the error....


The above problem occures because of version in-compatibility between PHP and MySql. Mostly it may occurs during remote access of db.

Kindly check your PHP and Mysql versions.

My versions are PHP-5.3.6(Local machine) and Mysql 5.1.56(Live DB).

My Mysql is placed in live domain and I kept my php files in local machine. I faced the same password rest problem.

Then I replace my XAMPP with older version it changed my PHP version to 5.3.0. Now the above problem was solved and able to access the live db from local.

Is This A Good Question/Topic? 0
  • +

Replies To: Question: Premature end of data (mysqlnd_wireprotocol.c:553)

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3712
  • View blog
  • Posts: 5,963
  • Joined: 08-June 10

Re: Question: Premature end of data (mysqlnd_wireprotocol.c:553)

Posted 18 September 2012 - 10:08 AM

Did you try resetting the password like the error message suggested?
Was This Post Helpful? 0
  • +
  • -

#3 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Re: Question: Premature end of data (mysqlnd_wireprotocol.c:553)

Posted 18 September 2012 - 10:51 AM

No not yet...I am researching how to do it now.
Was This Post Helpful? 0
  • +
  • -

#4 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Re: Question: Premature end of data (mysqlnd_wireprotocol.c:553)

Posted 18 September 2012 - 11:47 AM

Ok here is the deal! I didn't change my password...all I did was download Wamp PHP 5.2.2. After it installed I started Wamp, left clicked on Wamp in my icon tray, selected PHP->Version...and clicked on 5.2.2. Now the errors went away! After doing research I have come to the conclusion that this error occurs because of version in-compatibility between PHP and MySql. I hope this helps all that are paddling up the same creek!! HERE'S A PADDLE!!
Was This Post Helpful? 0
  • +
  • -

#5 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3712
  • View blog
  • Posts: 5,963
  • Joined: 08-June 10

Re: Question: Premature end of data (mysqlnd_wireprotocol.c:553)

Posted 18 September 2012 - 01:08 PM

O no. That is a horrible fix. I say that for two reasons.

First, the reason PHP 5.3 is incompatible with your MySQL server is because the server is, apparently, using the old, insecure authentication system which was replaced in MySQL 4.1 with a new, improved system. The mysqlnd client API (which was added to PHP in 5.3 to remove the reliance on the MySQL C API) does not support that, long deprecated, old authentication schema. - The proper fix for this, then, is to upgrade the authentication schema, not to downgrade PHP. All MySQL versions above 4.1 are capable of this. It just requires one simple command, which was even provided in the error message!

And second. PHP 5.2 is old. Aside from all the new features in 5.3 and 5.4, the 5.2 branch is no longer supported. That means no more updates. No more security fixes. Downgrading to that to avoid a critical, and long overdue, security upgrade should not be considered a viable option.

By the way, why 5.2.2? That's ancient, even for a 5.2 release. Over 5 years old... The 5.2 brach ended in 5.2.17, according to the docs.
Was This Post Helpful? 1
  • +
  • -

#6 BarNunBoi  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 232
  • Joined: 28-March 12

Re: Question: Premature end of data (mysqlnd_wireprotocol.c:553)

Posted 18 September 2012 - 01:48 PM

Well the reason I chose that is because I read somewhere that downgrading is a permanent fix! Apparently not! What I can say is "Thank You" for giving me a better understanding of the task at hand!

This post has been edited by BarNunBoi: 18 September 2012 - 01:50 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1