Client does not support authentication protocol requested by server

chris (2006-07-24 23:30:38)
2470 views
0 replies
The mysql client authentication protocol for mysql changed at version 4.1, which means that mysql clients earlier than version 4.1 will fail to connect. To be more precise, it was the password hashing algorithm which changed - I guess we don't have to worry about the details, but we do need to enable our databases to allow older versions of PHP (with earlier versions of mysql client) to talk to them.. Here's how it's done:

First connect to the mysql command line and update your client password with the old_password() function like this:
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpassword') WHERE Host = 'hostname' AND User = 'username';
mysql> FLUSH PRIVILEGES;

note that if the database is running on the same machine as the php script, then you might replace 'hostname' with 'localhost'

The mysql docs do suggest one or two other approaches to solving this problem (http://dev.mysql.com/doc/refman/5.0/en/old-client.html) but this one is by far the simplest

christo
comment