Reset MySQL password on Windows
Posted by firstruby on October 26, 2008
1) Log in as Administrator.
2) Stop the MySQL service. Go to Start menu > Control Panel > Administrative Tools > Services > Stop MySQL service.
3) Create “mysql-init.txt” file with following 2 lines,
UPDATE mysql.user SET Password=PASSWORD(‘mypassword’) WHERE User=’root’;
4) Open command prompt, and give following command to reset MySQL password,
“C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld-nt” –defaults-file=”C:\Program Files\MySQL\MySQL Server 5.0\my.ini” –init-file=C:\\mysql-init.txt
The appropriate –defaults-file setting can be found using the Services Manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list, right-click it, and choose the Properties option. The Path to executable field contains the –defaults-file setting.
5) After the server has started successfully, delete C:\mysql-init.txt