Why can't I log on to MySQL5 after I change my password?

Source: Internet
Author: User

First of all, I have not tried the following description only for other Windows systems. Mysql has modified the User Password format since 4.1.1, increasing from 16 bits to 41 BITs, A new verification method is adopted, but the client Protocol earlier than 4.1 does not support this method, so it causes the consequences of being unable to log on. even if the password is correct and cannot be properly logged on, the prompt is as follows:

#1250-Client does not support authentication protocol requested by server; consider upgrading MySQL client

Run the following command in the window:

C: mysqlbin> mysql-uroot

Welcome to the MySQL monitor. Commands end with; or g.

Your MySQL connection id is 1 to server version: 5.0.0-alpha-nt

Type 'help; 'or 'H' for help. Type 'C' to clear the buffer.

Mysql> select password ('A ');

+ ------------------------------------------- +

| Password ('A') |

+ ------------------------------------------- +

| * DEE59C300700AF9B586F9F2A702231C0AC373A13 |

+ ------------------------------------------- +

1 row in set (0.00 sec)

Mysql>

From the above, we can see that the password result returns a 41-Bit String starting with '*', which is 16 bits in the past.

The official Mysql website provides two solutions

1. Use the new client api,

2. force the server to use the old password

First, I tried the first method to copy libmysql from mysql5.0. dll to the extension directory of php, replacing libmysql with php itself. dll, but the results are disappointing. php prompts that php_mysql.dll loading failed: PHP Warning: PHP Startup: Unable to load dynamic library 'C:/php5/ext/php_mysql.dll '-the specified program cannot be found. Later I found that the new dll version lacks the mysql_drop_db () function: (only when php or mysql releases the updated dll.

The first method does not work. You only need to try the second method. The mysql official FAQ says that you need to add the-old-password parameter. First, I try to start mysql under the command line,

C: mysqlbin> mysqld-nt-old-password

Run in another window

C: mysqlbin> mysql-uroot

Welcome to the MySQL monitor. Commands end with; or g.

Your MySQL connection id is 540 to server version: 5.0.0-alpha-nt

Type 'help; 'or 'H' for help. Type 'C' to clear the buffer.

Mysql> select password ('mypassword ');

+ ------------------------ +

| Password ('mypassword') |

+ ------------------------ +

| 162eebfb6477e5d3 |

+ ------------------------ +

1 row in set (0.55 sec)

Mysql>

It can be seen that the password result is changed to 16 bits, and the change is gratifying.

In c: windowsmy. ini (xp, 98, 2000, add "set-variable = old-passwords" to the "mysqld" section in c: wint"

Example:

[Mysqld]

Basedir = C:/mysql

Set-variable = old-passwords

Datadir = C:/mysql/data

[WinMySQLadmin]

Server = C:/mysql/bin/mysqld-nt.exe

User = root

Password = mypassword

Start mysql in Service Manager

Later, I found that. in the user table, if the length of the password field is changed to 16, the system automatically switches to the oldpassword mode. After the password field is changed to 41, the system automatically switches to the new authentication mode. after changing the password method, you need to reset the password and refresh the permission (or restart mysql)

Note: For more exciting tutorials, please pay attention to the graphic tutorial channel of the customer's house,

Related Article

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.