Bug #60965 Resetting root password on Windows 7
Submitted: 24 Apr 2011 11:21 Modified: 7 Dec 2015 8:43
Reporter: David Sutherland Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.5.11 OS:Windows (7)
Assigned to: Assigned Account CPU Architecture:Any
Tags: root password

[24 Apr 2011 11:21] David Sutherland
Description:
The documentation describes how to reset the root password, but when I followed the instructions on my Windows 7 system with a registered service, the script hung up and I was unable to make the necessary change. There was also a reference to mysqld-nt which no longer exists, so I was using mysqld instead.

How to repeat:
Just try to follow the instructions on a Windows 7 system till you get stuck.

Suggested fix:
I eventually found a circumvention which is so useful that I would suggest that you incorporate it in the documentation: If you go to windows services and select the MySQL service then the general tab on the properties windows has a field called start parameters. You can simply stop the service (if necessary) and then start it again putting --init-file=C:\\mysql-init.txt into this field. The service will start with the new password.
[24 Apr 2011 14:23] Valeriy Kravchuk
Can you, please, explain what exactly is wrong with instructions at http://dev.mysql.com/doc/refman/5.5/en/resetting-permissions.html (documentation for recent version, 5.5)? 

They assume that you stop the windows service, then start mysqld (note mysqd, not mysqld-nt) manually with --init-file option, check that password is reset, then stop mysqld and start service as usual. What exact step is a problem in your case?
[24 Apr 2011 17:34] David Sutherland
The problem I encountered was that the script did not run manually. the service seemed to be starting but it hung up and would not start.
[25 Apr 2011 10:48] Valeriy Kravchuk
What exact version of server, 5.x.y, do you use?

As far as I understand, command like 

<path_to_server>\\mysqld --init-file=<path_to_file>\\mysql-init.txt

had not worked when started manually from cmd.exe. Please, confirm.
[26 Apr 2011 10:12] David Sutherland
I used 5.5.11. I don't know exactly what is going wrong as I have now retried it and the command ran to completion, but I was still unable to log in using the new password specified in the file. The only reliable way I was able to change the root password was to use the circumvention which I have described.
[18 May 2011 16:29] MySQL Verification Team
The question was if you was able to start manually the server can you confirm?. Thanks.
[18 Jun 2011 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[10 Jul 2015 13:03] Jonathan Martin
Had exactly the same experience as David Sutherland. Upgraded to MySQL 5.6.25 but at the critical moment could not remember my root password. On using the 'reset password' instructions found here;
http://dev.mysql.com/doc/refman/5.6/en/resetting-permissions.html
The console windows hangs and the MySQL server cannot be started except by rebooting.
David's work around worked perfectly, so many thanks for sharing your discovery.
[7 Nov 2015 8:43] MySQL Verification Team
Mostly likely the mysql-init.txt file had trailing spaces or newlines at the end.

Actually the init-file is not a required complexity you should worry about.

Just put skip-grant-tables into my.ini,  start mysqld as usual and login with root then :  

flush privileges;
create user myuser@'127.0.0.1' identified by 'mypassword';
grant all on *.* to myuser@'127.0.0.1' with grant option;

remove skip-grant-tables from my.ini and restart the mysqld.
[8 Dec 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".