MySQL error - Client does not support authentication protocol requested by server; consider upgrading MySQL client
Posted: Thu Aug 05, 2010 5:22 pm
I was working on a CGI on logdev01 and trying to connect to the MySQL running on dept01 but it was unable to connect.
When I tried the following from command line, it failed with error message:
Since I have compiled and installed all the latest perl modules for DBI and DBD:mysql, I know it is not the protocol or client version issue.
I searched on the internet and many had suggested to use the following command (in mysql) to make it the old password:
I checked MySQL version first:
It is version 5.0.51b, not too old.
Still, I moved ahead and reset the user's password:
After resetting it this way, I was able to connect to remote MySQL server (dept01) from logdev01. And the CGI on web site works too of course.
"mmcc" user info before password reset:
"mmcc" user info after password reset:
Password format is definitely different.
Excerpted from MySQL (http://dev.mysql.com/doc/refman/5.1/en/ ... d-password)
http://dev.mysql.com/doc/refman/5.1/en/ ... shing.html
I am not sure why I have to set the password back to the pre-4.1 password format while we are running 5.0 version. Very strange. My guess is dept01 has multiple versions of MySQL running and somehow it gets confused and accepts older password format only. Anyhow, this is the way to get it to work.
When I tried the following from command line, it failed with error message:
Code: Select all
perl test.cgi
DBI connect('MMCC:dept01.ols.minimed.com:3306','mmcc',...) failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client at .mysql/dbh line 10
Client does not support authentication protocol requested by server; consider upgrading MySQL client at .mysql/dbh line 10.
Compilation failed in require at user_registration.cgi line 24.
I searched on the internet and many had suggested to use the following command (in mysql) to make it the old password:
Code: Select all
mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
Code: Select all
mysql> status
--------------
mysql Ver 14.12 Distrib 5.0.51b, for redhat-linux-gnu (i686) using EditLine wrapper
Connection id: 23087
Current database:
Current user: mysql@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.0.51b-log Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: big5
Db characterset: big5
Client characterset: big5
Conn. characterset: big5
UNIX socket: /tmp/mysql.sock
Uptime: 191 days 20 hours 33 min 41 sec
Threads: 2 Questions: 1102267 Slow queries: 51 Opens: 92009 Flush tables: 1 Open tables: 64 Queries per second avg: 0.066
--------------
Still, I moved ahead and reset the user's password:
Code: Select all
mysql> set password for 'mmcc'@'%' = old_password('mmccus3r');
Query OK, 0 rows affected (0.02 sec)
"mmcc" user info before password reset:
Code: Select all
mysql> SHOW GRANTS FOR mmcc;
+-----------------------------------------------------------------------------------------------------+
| Grants for mmcc@% |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mmcc'@'%' IDENTIFIED BY PASSWORD '*23FA7D6797A14CA96BF99021347FDDE116DCD36E' |
| GRANT ALL PRIVILEGES ON `MMCC`.* TO 'mmcc'@'%' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
Code: Select all
mysql> SHOW GRANTS FOR mmcc;
+----------------------------------------------------------------------------+
| Grants for mmcc@% |
+----------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'mmcc'@'%' IDENTIFIED BY PASSWORD '4a8df0cf08a32f40' |
| GRANT ALL PRIVILEGES ON `MMCC`.* TO 'mmcc'@'%' WITH GRANT OPTION |
+----------------------------------------------------------------------------+
2 rows in set (0.00 sec)
Excerpted from MySQL (http://dev.mysql.com/doc/refman/5.1/en/ ... d-password)
Code: Select all
OLD_PASSWORD(str)
OLD_PASSWORD() was added when the implementation of PASSWORD() was changed in MySQL 4.1 to improve security. OLD_PASSWORD() returns the value of the pre-4.1 implementation of PASSWORD() as a binary string, and is intended to permit you to reset passwords for any pre-4.1 clients that need to connect to your version 5.1 MySQL server without locking them out. See Section 5.3.2.3, “Password Hashing in MySQL”.
Code: Select all
Prior to MySQL 4.1, password hashes computed by the PASSWORD() function are 16 bytes long. Such hashes look like this:
mysql> SELECT PASSWORD('mypass');
+--------------------+
| PASSWORD('mypass') |
+--------------------+
| 6f8c114b58f2ce9e |
+--------------------+
The Password column of the user table (in which these hashes are stored) also is 16 bytes long before MySQL 4.1.
As of MySQL 4.1, the PASSWORD() function has been modified to produce a longer 41-byte hash value:
mysql> SELECT PASSWORD('mypass');
+-------------------------------------------+
| PASSWORD('mypass') |
+-------------------------------------------+
| *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |
+-------------------------------------------+
Accordingly, the Password column in the user table also must be 41 bytes long to store these values: