Home  >  Article  >  Backend Development  >  Authentication protocol issues with PHP5 connecting to mysql5_PHP tutorial

Authentication protocol issues with PHP5 connecting to mysql5_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:23:30697browse

After MYSQL 4.1, a new user authentication protocol is adopted. For old clients, there will be an error that the authentication protocol is not supported. The following is the solution on the official website﹔
1Upgrade all client programs to use a 4.1.1 or newer client library.
Update the client library, which requires updating the PHP extension library. PHP no longer provides such an extension library for the old api
2When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.
Using a previously established account to connect will not work for accounts established under the new authentication protocol
3Reset 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: mysql> SET PASSWORD FOR
-> 'some_user' @'some_host' = OLD_PASSWORD('newpwd');
Alternatively, 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.
This is a good idea. The newly created account uses the old encryption protocol
4Tell the server to use the older password hashing algorithm:
Start mysqld with the --old-passwords option.
This way the advantages of the new authentication protocol cannot be used
5Assign 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: 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.
Reverts an upgraded password to the old style


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446870.htmlTechArticleAfter MYSQL 4.1, a new user authentication protocol is adopted. For old clients, authentication will not be supported. Protocol error, the following is the solution from the official website﹔ 1Upgrade all clien...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn