Windows2003 the MySQL root password forgot

Source: Internet
Author: User

First we want to enter your MySQL server, use net stop mysql to stop MySQL, and then run the DOS command, enter CMD in the run, and then switch to the MySQL bin directory, run the command:

The code is as follows Copy Code

Mysqld--defaults-file= "C:\Program files\mysql\mysql Server 5.1\my.ini"--console--skip-grant-tables

Now open a CMD window again

The code is as follows Copy Code

Enter command:

Mysql-uroot-p

Appear:

Enter Password:

Enter directly in here without entering the password.

Then there will be information about the success of the login,


To use the command:

The code is as follows Copy Code

show databases;

To switch to the MySQL database using a command:

The code is as follows Copy Code

Use MySQL;

To change the root password by using the command:

The code is as follows Copy Code

UPDATE user SET Password=password (' NewPassword ') where user= ' root ';


Refresh permissions:

The code is as follows Copy Code

FLUSH privileges;

Then exit and log back in:

The code is as follows Copy Code

Quit

Login again:

The code is as follows Copy Code

Mysql-uroot-p

Enter a password prompt and enter a new password to sign in:

The code is as follows Copy Code

Enter Password: ***********

Show Login information: Success it's all OK.


Another way is not directly into your MySQL security mode, is in the MySQL bin directory run mysqld-nt--skip-grant-tables and then the same as the following switch to the MySQL database to update on it.

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.