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

    Got Something To Say:

    Your email address will not be published. Required fields are marked *

    7 comments
    1. vinyll

      19 April, 2012 at 8:02 am

      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;

      Reply
    2. andrei

      12 April, 2011 at 1:34 pm

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

      Reply
      • memenode

        12 April, 2011 at 7:14 pm

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

        Reply
    3. andrei

      12 April, 2011 at 1:03 pm

      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.

      Reply
      • andrei

        12 April, 2011 at 1:31 pm

        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 😉

        Reply
    4. john

      28 March, 2011 at 3:00 pm

      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!

      Reply
    5. elrando

      3 October, 2010 at 3:08 am

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

      Reply
    Passwords
    179 queries in 0.515 seconds.