For some unknown reason I couldn’t log into my mysql database today. The error message was clear and simple, couldn’t connect to the database, wrong password.

After searching for about one hour, followed as well the guide from MySQL on «How to Reset the Root Password» without any luck, I found a solution that worked in my case, and I want to share that with you.

  1. Stop your MySQL server completely.
  2. Open your command line (cmd) and go to the MySQL bin folder.
  3. Excecute the following command:

    mysqld.exe -u root --skip-grant-tables

  4. Open a new command line without closing the previous one.
  5. Go to MySQL bin folder again, enter «mysql» and press enter.
  6. Now connect to «mysql» database by typing this command:

    use mysql

  7. Reset the root password by executing following command:

    UPDATE user SET Password=PASSWORD('yourpwd') WHERE User='root';

  8. Type exit on this cmd and close the other command line

Be aware sometime we have multiple «root»-users connecting with different hosts!

Hope this will help you as well.