Reset MySQL root password in Linux


Sometime back i wrote about resetting MySQL root password in Windows. I forgot my own password and hence had to crack it. I checked here but there was nothing for Linux. So to help up further, i’m writing this. And it’s pretty simple in Linux.

Before you proceed: You must have root access in your system.

1. Login to your system with root access

2. Stop running mysql service (mysqld stop)

3. Start mysql in safe mode without anypriviliges( mysqld_safe –skip-grant-tables & )

4. Now you can login to mysql root without password ( mysql -u root )

5. Now change the password of your root user ( update user set password=PASSWORD(‘newpassword’) where user=’root’

flush privileges )

6.  Restart  mysql service ( mysqld restart )

Voila you have changed your mysql root password to newpassword .

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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