Client does not support authentication protocol

Luego de agregar un nuevo usuario MySQL he tenido el siguiente problema al intentar conectarme a la DB usando PHP4:

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

Buscando llego a: http://dev.mysql.com/doc/refman/5.0/en/password-hashing.html

El problema

The password hashing mechanism was updated in MySQL 4.1 to provide better security and to reduce the risk of passwords being intercepted. However, this new mechanism is understood only by MySQL 4.1 (and newer) servers and clients, which can result in some compatibility problems.

Hace un tiempo pasé de la versión 4 a la 4.1. Resulta que ahora el hash correspondiente a las passwords se realiza utilizando un nuevo algoritmo que genera un hash de 41 bytes frente al viejo de 16 bytes.

Antes de la versión 4.1 la función

PASSWORD()

devolvía un hash de 16 bytes:

mysql> SELECT PASSWORD('mypass');
+--------------------+
| PASSWORD('mypass') |
+--------------------+
| 6f8c114b58f2ce9e   |
+--------------------+

A partir de la versión 4.1 la función

PASSWORD()

devuelve un hash de 41 bytes:

mysql> SELECT PASSWORD('mypass');
+-------------------------------------------+
| PASSWORD('mypass')                        |
+-------------------------------------------+
| *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |
+-------------------------------------------+

Solución

Según: Common Problems with MySQL and PHP.

Error: Client does not support authentication protocol: This is most often encountered when trying to use the older mysql extension with MySQL 4.1.1 and later. Possible solutions are: downgrade to MySQL 4.0; switch to PHP 5 and the newer mysqli extension; or configure the MySQL server with –old-passwords. (See Section A.2.3, “Client does not support authentication protocol”, for more information.)

Otra solución

La función

OLD_PASSWORD

devuelve el viejo hash de 16 bytes:

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

Tags: ,

Leave a Reply