nazly.me

Weblog of Nazly Ahmed

Nazly Ahmed

Nazly Ahmed

Web Developer. PHP Addict. Wordpress Hacker. FOSS Enthusiast. (Micro)Blogger. Photo Hobbyist. Cricket Fanatic. Husband. Dad.

I have been working on MySQL 4.0.17 till now and wanted to upgrad to MySQL 4.1. So I downloaded and installed MySQL 4.1 and the installation was successful and it was working fine. But when I tried to access it through PHPMyAdmin or from any of my PHP code it threw this error


Client does not support authentication protocol requested by server;
consider upgrading MySQL client

So I checked it out at MySQL.com to see what I was missing and found out that in MySQL 4.1 the authentication process has been upgraded by making the hashes more secure. So when trying to access it with an old client it throws the above error.

The mysql extension in PHP doesn't support the new authentication protocol. So the workaround for this will be to reset the passwords in the format prior to MySQL 4.1. This can be done by using the old_password() function. Make sure to only reset the passwords of the users that need to access using a client prior to 4.1. Here is how it can be done

1
2
3
 
mysql> SET PASSWORD FOR
    -> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

or

1
2
3
4
 
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
    -> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;

The mysqli extension (MySQL Improved) which comes with PHP 5 is compatible with the improved password hashing in MySQL 4.1 and above.

Posted on 11th June 2005 14:30:59