Windows forgot MySQL root password solution (graphic)

Source: Internet
Author: User
Tags mysql login

In Windows forgot the root password of MySQL for the novice, also will often encounter, I also happen to meet, refer to the solution on the Internet, and then tidy up a bit.

1. First, you need to see if the MySQL service is started.

Open cmd window, enter command: net start

  

2. If the MySQL service is already started, you will need to stop the MySQL service first.

Command: net stop MySQL

3. After you switch to your local mysqld installation directory, execute the following command:

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

Note: The path of the My.ini file under the Black font for your own local MySQL address

This command can skip the security check and turn on the MySQL service so you don't need to enter a password to connect to MySQL

4. Keep this cmd window not closed, new open a CMD window, log in to MySQL.

Command: Mysql-uroot-p

Appear:

Enter Password:

No need to enter the password, directly press ENTER button, will enter the MySQL database

5. Next, you can use the password Modification command to change the password.

Command:

Update user Set Password = password (' new password ') where user = ' root ';

6. Last Refresh Permissions

Command:

Flush privileges;

7. Exit

Command: Quit

8. Close all cmd windows and reopen a new CMD window, note: The MySQL service needs to be restarted

Start mysql service command: net start MySQL

After the 9.mysql service starts, enter the mysql login command to log in

Command: mysql-uroot-p New password

Windows forgot MySQL root password solution (graphic)

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.