MySQL sometimes forget the password how to do?

Source: Internet
Author: User
Keywords Web programming MySQL Tutorial
Tags close directory get how to how to do mysql mysql tutorial operation

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>

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.