Tuesday, November 18, 2008

How To Reset MySQL Root Password

Do you forget your MySQL root password and can't login? Don't panic. You don't have to re-install your MySQL as long as you still have the privileges to start and stop the MySQL service. Just follow these instruction:

1. Stop your MySQL service.
2. Start your MySQL service with this following command:
mysqld --skip-grant-tables

This command will start your MySQL service without checking the users tables everytime users login. So, you can login as root and reset your password.
3. Update your root password with this command.
USE mysql;
UPDATE user SET password=PASSWORD('new password') WHERE user='root';
4. Refresh the users' privileges.
FLUSH privileges;

Now, your MySQL root password has been updated with the new password. You can login to MySQL with that new password.

No comments: