Solve the Problem of forgetting the password of MySQL

Source: Internet
Author: User

From: http://www.php100.com/html/webkaifa/database/Mysql/2011/0324/7781.html

 

What if MySQL forgets its password sometimes? I will give a case and explanation! Solve the problem!

The actual operations in windows are as follows:

1. Disable running MySQL.

2. Open the DOS window and go to the MySQL \ bin directory.

3. Enter mysqld -- skip-grant-tables and press Enter. If no prompt is displayed, it is correct.

4. Open another DOS window (because the DOS window can no longer be moved) and go to the MySQL \ bin directory.

5. Enter MySQL and press Enter. If yes, a MySQL prompt is displayed.>

6. Connect to the permission database> use MySQL; (> is the original prompt, don't forget the last semicolon)

6. Change the password:> Update user SET Password = PASSWORD ("520") where user = "root"; (do not forget the last semicolon)

7. Refresh permissions (required steps)> flush privileges;

8. Exit> \ q

9. log out of the system, log on to MySQL, and log on to MySQL with the username "root" and the new password "123456.

Step 1

C: \ Documents ents and Settings \ Administrator> Cd D: \ WEB \ www.php100.com \ mysql se

Rver5.5 \ bin

C: \ Documents ents and Settings \ Administrator> D:

D: \ WEB \ www.php100.com \ mysql server5.5 \ bin> mysqld -- skip-grant-tables

Step 2

Microsoft Windows [version 5.2.3790]

(C) Copyright 1985-2003 Microsoft Corp.

C: \ Documents ents and Settings \ Administrator> Cd D: \ WEB \ www.php100.com \ mysql se

Rver5.5 \ bin

C: \ Documents ents and Settings \ Administrator> D:

D: \ WEB \ www.php100.com \ mysql server5.5 \ bin> 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) 2000,201 0, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

Affiliates. Other names may be trademarks of their 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: \ WEB \ www.php100.com \ mysql server5.5 \ bin>

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.