Q: I cannot log on to mysql5 after I change my password

Source: Internet
Author: User

Source: ChinaITLab

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: mysqlin> 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>
From the above, we can see that the password result returns a 41-Bit String starting with "*", which is a 16-Bit String.
  
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 fails: 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: mysqlin> mysqld-nt-old-password
  
Run in another window
C: mysqlin> 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
  
Very Good, everything is normal,
  
Later, I found that as long as the length of the password field in the mysql. user table is changed to 16, the system will automatically switch to the oldpassword mode, change to 41, and then automatically change to the new authentication method.
After changing the password method, you need to reset the password and refresh the permission (or restart mysql)

 

 

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.