Authentication protocol problem for PHP5 connection MYSQL5

Source: Internet
Author: User
Tags format flush mysql query client
mysql|php5| problem MYSQL 4.1 after the adoption of a new user authentication protocol, for the old client will appear unsupported authentication protocol errors, the following is the official website solution;

1Upgrade all client programs to use a 4.1.1 or newer client library.

Updating the client library, which requires an update to the PHP extension library, is not available for the old API PHP.

2When connecting to "server with a" pre-4.1 client program, use a, still has a pre-4.1-style password.

Use a previously established account to connect to an account that was created 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 is 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 ')-> ERE Host = ' some_host ' and User = ' some_user ';

mysql> FLUSH privileges;

Substitute the password you want to the "' Newpwd" in the preceding examples. MySQL cannot tell you what the original password is, so you'll need to pick a new one.

This is a good way to build a new account with an old-fashioned encryption protocol.

4Tell the server to use the older password hashing algorithm:

Start mysqld with the--old-passwords option.

The advantages of this new authentication protocol are not available.

5Assign a old-format password to the has had it password updated to the longer format. You can identify this accounts with the following query:mysql> SELECT Host, User, Password from Mysql.user

-> WHERE LENGTH (Password) > 16;

For the 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 restore has already upgraded the password to the old style.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.