• Main Menu
  • 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.

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

    • Abdullah Ramadan

      very useful

    • elrando

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

    • john

      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!

    • andrei

      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

        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 ;)

    • andrei

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

      • memenode

        I’m guessing either will be fine depending on context. Did single quotes work for anyone else?

    • vinyll

      Correct single quotes work, but not the one used in the blog post. This works indeed (regular single quotes here) :

      UPDATE mysql.user SET Password=PASSWORD(‘password’) WHERE User=’root’; FLUSH PRIVILEGES;

    Passwords