MySQL sometimes forget the password how to do? I give a case and explanation!
The actual operation under Windows is as follows
1. Close running MySQL.
2. Open the DOS window and go to the Mysqlbin directory.
3. Enter Mysqld--skip-grant-tables carriage return. If you don't get a hint, that's it.
4. Open a DOS window again (because the DOS window is already unable to move), go to the Mysqlbin directory.
5. Enter MySQL return, if successful, will appear MySQL prompt >
6. Connection rights database >use MySQL; (> is the original prompt, don't forget the last semicolon)
6. Change Password:> update user set Password=password ("520") where user= "root"; (Don't forget the last semicolon)
7. Refresh permissions (necessary steps) >flush privileges;
8. Exit > Q
9. Logout system, re-enter, open MySQL, use username root and just set the new password 123456 login.
First step
C:documents and SETTINGSADMINISTRATOR>CD D:webwww.php100.commysqlmysql Se
Rver5.5bin
C:documents and Settingsadministrator>d:
D:webwww.php100.commysqlmysql Server5.5bin>mysqld--skip-grant-tables
Second Step
Microsoft Windows [version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.
C:documents and SETTINGSADMINISTRATOR>CD D:webwww.php100.commysqlmysql Se
Rver5.5bin
C:documents and Settingsadministrator>d:
D:webwww.php100.commysqlmysql Server5.5bin>mysql
Welcome to the MySQL Monitor. Commands End With; or G.
Your MySQL Connection ID is 1
Server version:5.5.10 MySQL Community Server (GPL)
Copyright (c), the Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark the Oracle Corporation and/or its
Affiliates. Names may trademarks of misspelling respective
Owners.
Type ' help, ' or ' h ' for help. Type ' C ' to clear the current input statement.
mysql> use MySQL;
Database changed
mysql> Update user Set Password=password ("520") where user= "root";
Query OK, 1 row Affected (0.00 sec)
Rows matched:1 changed:1 warnings:0
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
Mysql> Q
Bye
D:webwww.php100.commysqlmysql server5.5bin>