RSS Feed

How to Reset a MySQL Password

A MySQL password can be reset in 5 easy steps:

  1. Stop the mysqld daemon process.
  2. Start the mysqld daemon process with the –skip-grant-tables option.
  3. Start the mysql client with the -u root option.
  4. Execute the UPDATE mysql.user SET Password=PASSWORD(‘password’) WHERE User=’root’;
  5. Execute the FLUSH PRIVILEGES; command.

These steps reset the password for the “root” account to “password.” To change the password for a different account or to set a different password, just edit the variables in single quotes in step 4.reset mysql password How to Reset a MySQL Password

If the user knows his/her existing MySQL root password, steps 1-3 are not necessary.

Respond to “How to Reset a MySQL Password”
  1. Abdullah Ramadan says:

    very useful

  2. elrando says:

    8) Thank you very much, I finally can login to my phpmyadmin. Thank you for blessing the internet with actual real and useful information.

  3. john says:

    Hi i would like to know how to make my mysql console stop asking for password.When i installed mysql firsttime i could login directly without a password.I do know my current password but would like to go back to as it were.
    Thanks in advance!

  4. andrei says:

    It doesn’t work, nothing happens after I type UPDATE mysql.user SET Password=PASSWORD(‘password’) WHERE User=’root’; My console changes from ‘mysql>’ to ‘`>’ and that’s all.

    • andrei says:

      You might have a syntax error in the command at step 4, it should be

      UPDATE mysql.user SET Password=PASSWORD(“password”) WHERE User=”root”;
      This works for me. Cheers ;)

  5. andrei says:

    I mean, there should be double-quotes instead of single-quotes, seems like my command line makes a difference on this…

Leave a Reply

Post your comments and questions below, but please follow our commenting guidelines.


Path: Home > Security > Passwords > How to Reset a MySQL Password