Skip to content

Instantly share code, notes, and snippets.

@erycamel
Last active September 4, 2019 08:41
Show Gist options
  • Save erycamel/99486412d3cf60121c037deb56ae9222 to your computer and use it in GitHub Desktop.
Save erycamel/99486412d3cf60121c037deb56ae9222 to your computer and use it in GitHub Desktop.
Reset Forgotten MySql root Password Under Windows
1. Stop your MySQL server completely. This can be done from Wamp(if you use it), or start “services.msc” using Run window, and stop the service there.
2. Open your MS-DOS command prompt using “cmd” inside the Run window. Then go to your MySQL bin folder, such as C:\MySQL\bin. Path is different if you use Wamp.
3. Execute the following command in the command prompt:
mysqld.exe -u root --skip-grant-tables
4. Leave the current MS-DOS command prompt as it is, and open a new MS-DOS command prompt window.
5. Go to your MySQL bin folder again.
6. Enter “mysql” and press enter.
7. You should now have the MySQL command prompt working. Type “use mysql;” so that we switch to the “mysql” database.
8. Execute the following command to update the password:
UPDATE user SET Password = PASSWORD('your_new_passowrd') WHERE User = 'root';
However, you can now run almost any SQL command that you wish.
After you are finished close the first command prompt, and type “exit;” in the second command prompt.
You can now start the MySQL service. That’s it.
https://jovicailic.org/2012/04/reset-forgotten-mysql-root-password-under-windows/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment