Modify the MySQL root user password under Windows

Source: Internet
Author: User

Forgetting the root password of MySQL is a daunting problem.

Let's take a look at how to reset the root password below Windows7.

1. Open a command-line window: It is important to note that you should open it as an administrator;

2. Turn off MySQL service: net stop MySQL

3, run Mysqld--skip-grant-tables. This command is to let MySQL boot time to skip the authorization table, it is important to note that there are many places on the internet is mysqld-nt, but the new version has been replaced by MYSQLD.

4. Reopen a command-line window (open with administrator),

Run command: mysql-u root; Enter MySQL without entering the password at this time;

Use MySQL; Select MySQL database;

Update user Set Password = Password (' newpass ') where user = ' root '; Do not forget the password function, the field is not case-sensitive, but the best capitalization is the first letter.

5, running flush privileges; To flush Cached permissions

6, Eixt; Quit MySQL

7, mysql-u root-p login mysql with new password

Running the Mysqld,mysql command above, you need to add the bin directory under the MySQL installation directory into the environment variable. Otherwise you need to go to the bin directory to run each command.

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.