2

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.

Marcelo Pascual
  • 810
  • 8
  • 20
  • Are you sure that for the dev connection you have the same password as for the prod connection? – Stephan May 20 '13 at 11:10
  • When you say `old_password`, I presume you mean [`old_passwords`](https://dev.mysql.com/doc/en/server-system-variables.html#sysvar_old_passwords) (note the variable name is in the plural); and, as you "*have no admin privileges to do it in MySQL itself*", I presume you have only set that system variable for your *session* (and not globally)? If so, how have you managed to connect & authenticate? Can you not use such authenticated session to `SET PASSWORD` as suggested in the error message? – eggyal May 20 '13 at 12:04
  • @Stephan Yes, same password. – Marcelo Pascual May 20 '13 at 16:04
  • @eggyal Sorry, meant old_passwords (edited). `old_passwords` is set Off globally (as I can see with `SHOW VARIABLES` and `SHOW GLOBAL VARIABLES` statements, never set up for session). I connect through a SQL GUI client (SQLYog) without problems, but with PHP via mysqlnd connection isn't possible. – Marcelo Pascual May 20 '13 at 16:08
  • FYI, I reported it as a possible PHP bug. There you have more information https://bugs.php.net/bug.php?id=64870 – Marcelo Pascual May 20 '13 at 16:11
  • I don't think it's a PHP bug. Having connected from SQLYog, why can't you issue `SET PASSWORD`, as suggested in the error message? – eggyal May 20 '13 at 19:36
  • Because I don't have admin privileges. If I run the query, it will change for the session only, not globally or for the user. – Marcelo Pascual May 20 '13 at 19:54

0 Answers0