1. stop all mysql services
2. open notepad then type> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
3. then save it to c: drive with any name .. like this "c:/example.txt"
4. now goto your mysql falder mysql(your version) > bin in my case path is "C:\mysql5.6.17\bin"
5. now copy your path then run cmd with (ctrl + r) then type "cmd" (enter)
6. type cd then right click on cmd and paste path (enter) now type (mysqld --init-file=C:\example.txt) without braces then (enter)
2. open notepad then type> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('');
3. then save it to c: drive with any name .. like this "c:/example.txt"
4. now goto your mysql falder mysql(your version) > bin in my case path is "C:\mysql5.6.17\bin"
5. now copy your path then run cmd with (ctrl + r) then type "cmd" (enter)
6. type cd then right click on cmd and paste path (enter) now type (mysqld --init-file=C:\example.txt) without braces then (enter)
7. then restart PC or open taskmgr and start mysql service and your password will be removed.
引用自:http://stackoverflow.com/questions/10070401/mysql-root-password-forgotten