Change/Reset mysql password

You can use the below steps :

1) service mysqld stop
2) mysqld_safe --skip-grant-tables &
3) (hit the enter key)
4) mysql -u root
5) use mysql;
6) update user set password=PASSWORD("MYNEWPASSWORD") where User='root';
7) flush privileges;
8) quit
9) service mysqld restart
10) mysql -u root -p

If you know the old password, use the below command to change the root password :

 mysqladmin -u root -p'oldpassword' password newpassword 

Enjoy 🙂

Advertisements

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