Problem Statement
How to reset MySQL root password without old root password in Windows server?Following are the steps to reset MySQL root password without old root password in Windows server:
- Stop MySQL Service from Windows Server.Start ->Administrative Tools -> Services.
Locate MySQL service and stop it. - Open command prompt.Click on Start -> Run -> cmd.
- Go to MySQL installation directory i.e. C:\Program Files\MySQL\MySQL server 5.1\
- Go to Bin directory.
- Run command mysqld.exe – skip-grant-tables.
- Now, leave this command prompt window open.
- Open new command prompt window and go to bin directory of MySQL installation.
- Type command mysql, it should prompt you to mysql console.
- Type command use mysql.
- Type command
UPDATE mysql.user SET Password=PASSWORD('MyNewPassword') WHERE User='root'; (where MyNewPassword should be the new password you wish to reset).
- Type command FLUSH PRIVILEGES.
- Start MySQL service.
- It should reset your MySQL password and you should be able to login as a root using the new password you have set for MySQL.