1. Error
2. When you are sure that you have forgotten your MySQL password, you can reset the root user password by using the following scenario. Double-click Open C:\Program files\mysql\mysql Server 5.1\my.ini file, such as:
3. Click "Edit" at the top of the "Notepad" software, select "Find", enter [mysqld] at "Find what", and click "Find Next", it will automatically go to the [mysqld] Field row. Add a line skip-grant-tables below and save it, such as: "mysql_5.6 no My.ini file, you can copy the My-default.ini file to My.ini and add Skip-grant-tables"
4. Click "Start" in the lower left corner, "Administrative Tools", "services". Right-click on the "MySQL" service in the list of services and select "Restart", such as:
5. Open MySQL, you can cmd-mysql enter;
Enter use MySQL; press ENTER, the database changed prompt appears. Then enter update user set Password=password (' New password ') WHERE user= ' root '; press ENTER. For example: You need to set the password is mysql789, then you need to enter the update user set Password=password (' mysql789 ') WHERE user= ' root ', if you are concerned about the input error, you can directly copy the content, right mouse button in the point to the console blank, select "Paste", and then press ENTER to run, there is a prompt "Query OK, 2 rows Affected (0.00 sec) rows Matched:2 changed:2 warnings:0". Such as.
6. Enter the flush privileges; press ENTER, and the "Query OK, 0 rows Affected (0.00 sec)" prompt appears. Remove the skip-grant-tables from the line below the [mysqld] field in My.ini and restart the MySQL service again. At this point, connect the database with the new password mysql789, such as:
Done!!!
How MySQL resets the root user password "pro-Test available"