mysqlnd: Cannot connect to MySQL 5.5.24, old_passwords is Off

Marcelo Pascual picture Marcelo Pascual · May 17, 2013 · Viewed 7.1k times · Source

I have two enviroments:

  • Dev: Windows 7, PHP 5.3.24, Apache 2.2.24
  • Production: Linux, PHP 5.4.10, Apache

Both connects to a remote MySQL 5.5.24 Server. Remote connections are allowed.

I replaced all mysql functions to mysqli. In production it connects OK, but in dev throughs the following errors:

Premature end of data (mysqlnd_wireprotocol.c:553)
OK packet 1 bytes shorter than expected
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 that the MySQL is 5.5.24, not 4.1, and old_passwords is set Off. I even changed user's password (from hosting panel, I have no admin privileges to do it in MySQL itself).

I even tried with a newer version of PHP (5.4.15), and the problem persists.

All references I read points to outdated MySQL Server (not this case), old_password issue (again not this case because it connects OK on production).

UPDATE:

Old mysql functions don't work neither. Before changing mysql to mysqli, I was using PHP 5.2.* version, and it worked. So I'm almost sure that the problem has to do with bundled mysqlnd.

Answer