In this article we will help you on “How you can forget, change or reset password of MySQL” running on Windows XP, 7, 8 or Windows 10 with 32 bit or 64 bit architecture.
Note: Make sure you have login as an Administrator.
1. Stopping MySQL
Before we being with password reset process we need to stop MySQL from running in the background. In order to stop MySQL from running in Windows Services follow below steps:
- Open Run from Start or using Windows key + R
- Type services.msc and press enter or click on OK button.
- In the Services window locate MySQL and Right Click on it followed by Stop option.
- Close the Services window, once you have successfully stopped MySQL.
- Now open notepad and type following lines:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
- Replace
MyNewPass
with your desired password. - Save the file in the C:\ drive with
mysql-init.txt
file name. - Open the command promote, once you have saved the file in
C:\mysql-init.txt
- To open command promote, press Window key+ R and type CMD in the field and press enter.
- Type following code in the command promote-
For 32-bit of Windows architecture :
C:\> cd "C:\Program Files\MySQL\MySQL Server 5.0\bin" C:\> mysqld-nt --init-file=C:\\mysql-init.txt C:\> mysqld-nt --defaults-file="C:\\Program Files\\MySQL\\MySQL Server 5.0\\my.ini" --init-file=C:\\mysql-init.txt
For 64-bit architecture :
C:\> cd "C:\Program Files (x86)\MySQL\MySQL Server 5.0\bin" C:\> mysqld-nt --init-file=C:\\mysql-init.txt C:\> mysqld-nt --defaults-file="C:\\Program Files(x86)\\MySQL\\MySQL Server 5.0\\my.ini" --init-file=C:\\mysql-init.txt
- Restart the the computer.
- Once the computer restarts, delete the
mysql-init.txt
fromC:\
drive.
Cheers!
That’s all folks.