Reset MySQL Root Password

There are number of ways to reset MySQL root password. I’m going to discuss one easy way here. This is basically for Windows installation of MySQL.

Here we go:

  • Find the installation folder of MySQL
    In my case, I used XAMPP. So I looked under xampp/ mysql/bin
  • Edit the mysql configuration file, my.ini
    Add skip-grant-tables just below [mysqld] , save the file and restart mysql
  • After adding skip grant tables, all the privileges will be skipped and hence you’ll be able to login without any restriction.
  • Now that all the privileges are off, you may change the root password, run the following query
    UPDATE mysql.user SET Password=PASSWORD(‘yourpassword’) WHERE User=’root’

This will update root’s password to yourpassword. Now edit the mysql configuration file(my.ini) and remove skip-grant-tables, save the file and restart mysql service.

Congratulations you’ve successfully reset mysql root password, login with new password.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s