RSS
people

How to reset MySQL root password

Share/Save/Bookmark

As a database administrator, you might forget the root password for your database. It is a serious problem. This tutorial is to teach you how to reset the root password if you forget it.

  1. Stop the MySQL service.
  2. /etc/init.d/mysql stop

  3. Start the MySQL in the save mode.
  4. mysqld_safe –skip-grant-tables &

  5. Login into MySQL as root user
  6. mysql -u root

  7. Update the root user password.
  8. mysql> use mysql;
    mysql> update user set password=PASSWORD(“NEW PASSWORD”) where user=’root’;
    mysql> flush privileges;
    mysql> quit;

  9. Restart the MySQL service & try to login using the new password.
  10. /etc/init.d/mysql stop
    /etc/init.d/mysql start

    mysql -u root -p

3 Responses to “How to reset MySQL root password”

  1. Paul said:
    February 11th, 2009 at 5:44 pm

    it’d be safer to go with

    mysqld_safe –skip-grant-tables –skip-networking &

    1. phani kumar.P said:
      April 11th, 2009 at 8:58 pm

      here there is no clear answer for this Question, Please Give me clear Answer.

      1. phani kumar.P said:
        April 11th, 2009 at 9:19 pm

        hey its very Clear thanking you Sir,

        Leave a Reply