Client does not support authentication protocol requested by server

1 May 2006


I’ve been bitten by this one when trying to maintain different sites with different versions of php / MySQL.

Basically, user authentication for the later versions of MySQL server (versions 4.1 and above) has been improved and it now uses a default password hashing algorithm that is incompatible with older clients, including the standard PHP mysql extension.

The work-around is to reset the MySQL password to pre-4.1 style for all the accounts which connect via php

SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

However, the mysqli extension (short for “mysql, improved”) which comes with Php5 is compatible with the improved password hashing and no special steps need be taken.