Tuesday, April 15, 2008

Warning: mysql_connect(): Client does not support authentication protocol requested by server



I was using the PHP v4.4.2 and MySQL 4.1.18 to develop a website which displaying data that retrieve from database.

Have you ever encounter an error saying the message at below?



The error display such as "Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in....."


Well, the problem is more likely caused by the updated security model within the MySQL 4.1 and later. The prior MySQL 4.1.0 is using a 16 byte hash code to encrypt the password into binary string. Whereas, the MySQL 4.1.1 or later is using 41 bytes.

So, you may likely want to reset the user’s password within your MySQL using OLD_PASSWORD. The OLD_PASSWORD() was implemented when the PASSWORD() was changed to improve the security.

Before I do anything on my MySQL server, I take a closer look to see how’s my password been stored within the database. I am signing as ROOT user which having all the privilege rights.

I look through the database called mysql and table called user. Next I retrieve the password field which is in binary string. See the screen below.



Next, I will update the researcher password using the OLD_PASSWORD function.



Finally, I refresh my website and every things work fine.