Saturday, April 17, 2010

Resetting MySQL Root Password

This is what you can do to resetting your mysql root access in case you're forget it. I just copy and paste it from mysql official website. Use it wisely, guys :)

On any platform, you can set the new password using the mysql client (but this approach is less secure):
  1. Stop mysqld and restart it with the --skip-grant-tables option.
  2. Connect to the mysqld server with this command:

    shell> mysql
  3. Issue the following statements in the mysql client. Replace the password with the password that you want to use.

    mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
        ->                   WHERE User='root';
    mysql> FLUSH PRIVILEGES;
You should now be able to connect to MySQL as root using the new password.

No comments:

Post a Comment

Hi, for all of those who already put comments on my blog post, thanks.. really appreciate it. And for those who have not, just put your comments here :)