MySQL 5.1 employs an authentication protocol based on the password-mix algorithm, which is incompatible with the protocol used by the earlier client (before 4.1). If you upgrade the server to 4.1, connecting with an earlier client may fail with the following message:
shell> MySQL
The client does not support the authentication protocol requested by the server: please consider upgrading the MySQL client.
To resolve this issue, you should use one of the following methods:
• Upgrade all client programs to use the 4.1.1 or updated client library.
• Use an account that still has a style password prior to version 4.1 when connecting to the server with a client prior to version 4.1.
• Restore the password to the style before version 4.1 for each user who needs to use the client before version 4.1. You can use the Set PASSWORD statement and the Old_password () function to accomplish this task:
·mysql> SET PASSWORD FOR
·-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');
也可以使用UPDATE和FLUSH PRIVILEGES:
mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;
Replace the "newpwd" in the precedent with the password you intend to use. MySQL cannot tell you what the original password is, so you need to select a new password.
• Notifies the server to use the old password-mix algorithm:
1. Use the "--old-passwords" option to start the mysqld.
2. For each account for which the password has been updated to a longer 4.1 format, specify the password with the old format. These accounts can be determined using the following query:
3.
Mysql> SELECT Host, User, Password from Mysql.user
4.
-> WHERE LENGTH (Password) > 16;
For each account record that the query displays, use the host and user values and specify the password using the Old_password () function and one of the set PASSWORD or update, as described earlier.
Note: In earlier versions of PHP, MySQL extensions did not support the authentication protocol in the MySQL 4.1.1 and higher editions. Whatever PHP version is used, it is correct. If you plan to use MySQL extensions with MySQL 4.1 or later, you need to configure MySQL to work with older clients using one of the options described earlier. The mysqli extension (which supports "improved MySQL", added in PHP 5) is compatible with the improved password mix algorithm used in MySQL 4.1 and later, and does not require a special configuration of MySQL to use the MySQL client library.