views:

1149

answers:

3

I just updated php to 5.3 and can no longer connect to my remote mysql server. I get the following errors:

mysqli_connect(): OK packet 6 bytes shorter than expected
mysqli_connect(): (HY000/2000): mysqlnd cannot connect to MySQL 4.1+ using old authentication

It seems this has to do with the new mysqlnd driver. Is there a way to force it to use the old libmysql driver. Also, reverting to php5.2.11 doesn't seem to fix the issue which seems to work for most people. Anyone have any suggestions? thanks!

A: 

http://dev.mysql.com/doc/refman/5.1/en/old-client.html says:

Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function:

mysql> SET PASSWORD FOR -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd'); Alternatively, use UPDATE and FLUSH PRIVILEGES:

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') -> WHERE Host = 'some_host' AND User = 'some_user'; mysql> FLUSH PRIVILEGES; Substitute the password you want to use for “newpwd” in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one.

Tell the server to use the older password hashing algorithm:

Start mysqld with the --old-passwords option.

There are many more options on this page....

powtac
I believe the php language / mysql_connect function will be dropping support for the OLD PASSWORD authentication as of php5.3. this is the problem I seem to be dealing with. the server runs php5.2.11 and uses the old 16 byte password encryption while the client is expecting the new 41 byte password encryption. when i try to change the password using SET PASSWORD, it still gives me a 16 byte password
bobbyb
A: 

See this.

Just reset the user's password.

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mypassword');
Ngu Soon Hui
i've already tried this with no luck
bobbyb
this gave me the same 16 byte encryption i already had, not the 41 byte one i would like
bobbyb
i've read somewhere that there is a setting that would do this but i've had no luck finding it
bobbyb
+1  A: 

Well I typed up a long cool response but someone better than me already has answered it. The tldr; of this response is recompile your php for your application.

http://news.php.net/php.internals/43535

Ionut G. Stan schrieb:

Warning: mysql_connect() [function.mysql-connect]: OK packet 6 bytes shorter than expected in {filename} on line 18 Warning: mysql_connect() [function.mysql-connect]: mysqlnd cannot connect to MySQL 4.1+ using old authentication in {filename} on line 18

This says everything. You cannot use old authentication with mysqlnd.

Upgrade you server passwords to the more recent and more secure authentication method or recompile PHP with libmysql (MySQL Client Library) support. Check ./configure --help | grep -C3 mysql and http://www.php.net/manual/en/mysql.installation.php .

Cranium Slows