MySQL5 password can not log on after the answer to the question

Source: Internet
Author: User
Tags command line mysql client mysql in reset

First of all, the following description is limited to the win system other systems I have not tried, Mysql since 4.1.1 modified the user password format, from 16 to 41 bits, using a new authentication method, However, 4.1 of the previous client protocols do not support this method, so it caused the consequences of not boarding. Even if the password is correct to log on correctly, the prompts are as follows:

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

To execute in a 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 (' AA ');

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

| Password (' AA ') |

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

| *dee59c300700af9b586f9f2a702231c0ac373a13 |

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

1 row in Set (0.00 sec)

Mysql>

It can be seen from the above that the result of password returns a 41-bit string that begins with a ' * ' number, which was previously 16-bit.

MySQL official website gives two kinds of solutions

1, using the new client API,

2, forcing the server to use the old password scheme

I first tried the first approach, copying Libmysql.dll from mysql5.0 to PHP's extended directory, instead of the libmysql.dll that came with PHP itself, but the result was disappointing. PHP Prompts Mount Php_mysql.dll failed: Php warning:php startup:unable to load Dynamic Library ' C:/php5/ext/php_mysql.dll '-the specified program was not found. It was later discovered that the mysql_drop_db () function was missing from the new version of the DLL:( Only wait for PHP or MySQL out of the updated DLL.

The first method doesn't work, only try the second approach, the MySQL official FAQ says, "You need to add the-old-password parameter, I first 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 results of password into 16-bit, gratifying changes

I add "set-variable=old-passwords" in the "mysqld" section of C:windowsmy.ini (Xp,98, 2000, under C:wint).

Cases:

[Mysqld]

Basedir=c:/mysql

Set-variable=old-passwords

Datadir=c:/mysql/data

[Winmysqladmin]

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

User=root

Password=mypassword

Then start MySQL in the service Manager

Later I found that as long as the Mysql.user table in the password of the length of the field to 16 system automatically switched to the OldPassword mode, changed back to 41 after The new verification method is automatically changed. Here to remind you, change the password mode, to reset the password and refresh the permissions (or reset MySQL)

Note : For more wonderful tutorials, please pay attention to the triple graphics tutorial channel,

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.