Forgot mysql root password?


Hello again!

I am wondering if anyone of you forgot your mysql db password for root user? Because I did.. LOL!!

So whats the bad thing with this? Oh! dear! its pretty bad because root user is the super admin for your DB and if you cant go through this.. you are screwed. You can’t manage DBs, cant manage users, permission and list is endless.

Here I found a simple way to reset your root password.

#Open your terminal.

first step is ofcourse opening your terminal.

#Stop the MySQL Server.

stop your server using below command.

sudo /etc/init.d/mysql stop

#Start the mysqld configuration.

To move ahead, we have to start this in configuration mode.

sudo mysqld --skip-grant-tables &

#Login to MySQL as root.

Don’t worry, It won’t ask for your password.

mysql -u root mysql

#Update your password

UPDATE user SET Password=PASSWORD('imissyoubuddy') WHERE User='root'; FLUSH PRIVILEGES; exit;

Run above command and I am guessing that you will replace imissyoubuddy with your own password.


Happy Learning!!


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 )

Connecting to %s