I haven't been writing logs here for a long time. Because I applied for a personal homepage and used phpMyAdmin to maintain remote MySQL, I also set up an environment on the local device. However, the client may not support the authentication protocol in any case, so I found the MySQL document and made a record.
MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients. if you upgrade the server from 4.0, attempts to connect to it with an older client may fail with the following message:
The authentication protocol for MySQL 4.1 and later versions uses the password hashing mechanism that is incompatible with clients of earlier versions. If you upgrade from version 4.0 and try to connect with the old client, you will receive the following failure message:
Shell> MySQL
Client does not support Authentication Protocol requested
By server; consider upgrading MYSQL client
to solve this problem, you should use one of the following approaches:
to solve this problem, take one of the following steps:
Upgrade all client programs to use a 4.1.1 or newer client library.
Upgrade all clients Program to use the client library of version 4.1.1 or later.
when connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.
when a client before version 4.1 is used, an account in password format earlier than Version 4.1 is used to connect to the server.
Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. this can be done using the set password statement and the old_password () function:
Reset the password format to the pre-4.1 format for users who need to use client programs Before Version 4.1. You can use the set password statement and the old_password () function to achieve this goal:
mysql> set password for
-> 'some _ user' @ 'some _ host' = old_password ('newpwd');
Alternatively, use update and flush privileges:
In addition, use update and flush privileges:
mysql> Update MySQL. user SET Password = old_password ('newpwd')
-> where host = 'some _ host' and user = 'some _ user';
mysql> flush privileges;
Substitute the password you want to use for "newpwd" in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one.
In the above example, replace the password with the new password "newpwd". MySQL cannot tell you what the original password is. Therefore, you need to provide a new password to replace it.
Tell the server to use the older Password Hashing Algorithm:
Let the server apply the old password hashing mechanism:
Start mysqld with the -- old-passwords option.
Add the -- old-passwords option when starting mysqld.
Assign an old-format password to each account that has had its password updated to the longer 4.1 format. You can identify these accounts with the following query:
Set the old password format for an account that has been upgraded to version 4.1. You can use the following statement to find these accounts:
Mysql> select host, user, password from mysql. User
-> Where length (password)> 16;
For each account record displayed by the query, use the host and user values and assign a password using the old_password () function and either set password or update, as described earlier.
In the query result, each account uses the old_password () function or the set password or update function based on the host and user values to set the old password format.
Note: in PHP, the standard MySQL extension does not support the new authentication protocol in MySQL 4.1.1 and higher. this is true regardless of the PHP version being used. if you want to use the MySQL extension with MySQL 4.1 or newer, you will need to follow one of the options discussed above for working MySQL to work with old clients.
Note: in PHP, standard MySQL extensions do not support the new verification protocols in MySQL 4.1.1 or later versions. The current PHP version is ignored. If you want to use MySQL extension mysql4.1 or above, you need to apply the method discussed above to configure MySQL to make it work normally.
The mysqli extension (stands for "MySQL, improved"; new in PHP 5) is compatible with the improved Password Hashing employed in MySQL 4.1 and higher, and no special configuration of MySQL need be done to use this newer MYSQL client library for PHP. for more information about the mysqli extension, see http://php.net/mysqli.
Mysqli extension ("MySQL, improved" standard; added in PhP5) supports Password Hashing for MySQL and later versions. Therefore, you do not need to make any special configuration when using the new MYSQL client library. For more information about mysqli extensions, see the http://php.net/mysqli
It may also be possible to compile the older MySQL extension against the new MYSQL client library. this is beyond the scope of this manual; Consult the PHP documentation for more information. you also be able to obtain authentication ance with these issues in our MySQL with PHP forum.
It is also possible to compile the old MySQL extension to support the new password hashing. However, this discussion is beyond the scope of this article. You can refer to the PHP document for more information.
For additional background on Password Hashing and authentication, see section 5.7.9, "Password Hashing as of MySQL 4.1 ".
For more information about password hashing and authentication background, see section 5.7.9, "Password Hashing as of MySQL 4.1 ".