Authentication Protocol for connecting PHP5 to Mysql5
Source: Internet
Author: User
MYSQL4.1 and later, a new user authentication protocol is adopted. for old clients, there will be errors that do not support the authentication protocol. The following is the solution on the official website: 1Upgradeallclientprogramstousea4. 1.1ornewerclientlibrary. update the client library, which requires updating the PHP Extension Library. After MYSQL 4.1, a new user authentication protocol is adopted. for old clients that do not support the authentication protocol, the following solutions are provided on the official website ﹔
1 Upgrade all client programs to use a 4.1.1 or newer client library.
Update the client library, which requires updating the PHP Extension Library. for the old api PHP, this extension library is no longer provided.
2 When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.
Using the previously established account connection will not work for accounts created under the new Authentication Protocol
3 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: mysql> SET PASSWORD
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 method. the new account uses the old-fashioned encryption protocol.
4 Tell the server to use the older password hashing algorithm:
Start mysqld with the -- old-passwords option.
In this way, the advantages of the new authentication protocol cannot be used.
5 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: 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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.