About MYSQL5 password can not log on after the answer to the question

Source: Internet
Author: User
Tags command line mysql mysql client mysql in reset version variable window
Mysql| Solutions | questions
About the problem that MYSQL5 can not log on after changing password
Felixsun
2004-04-19
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-bit to 41-bit, using a new authentication method,

However, 4.1 of the previous client protocols do not support this approach, resulting in the consequences of not boarding.
Do not log in correctly even if the password is correct, the following prompts
#1250-client does not support authentication protocol requested by server; Consider upgrading MySQL client


To execute in a window:
C:\mysql\bin>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>
You can see 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 approach does not work, only try the second approach, the MySQL official FAQ says, the need to add-old-password this parameter,
I first tried to start MySQL under the command line,
C:\mysql\bin>mysqld-nt-old-password

Run in another window
C:\mysql\bin>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,
[Omission of several detours ...]
I add "set-variable=old-passwords" in the "mysqld" section of C:\windows\my.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

Very good, everything is fine,

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 and then automatically changed to a new way of verification.
Here to remind, change the password mode, to reset the password and refresh the permissions (or reset MySQL)



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.