Reset mysql root password

By | July 31, 2017
mysqladmin command to change root password

In the event that you have never set a root watchword for MySQL, the server does not require a secret key at all to connect as root. To setup pull watchword for the first time, utilize mysqladmin charge at shell fast as takes after:

$ mysqladmin -u root password NEWPASSWORD

However, if you want to change (or update) a root password, then you need to use following command
$ mysqladmin -u root -p’oldpassword’ password newpass

For example, If old password is abc, and set new password to 123456, enter:
$ mysqladmin -u root -p’abc’ password ‘123456’

Change MySQL password for other user

To change a normal user password you need to type (let us assume you would like to change the password for rahul):

$ mysqladmin -u rahul -p oldpassword password newpass

Leave a Reply

Your email address will not be published. Required fields are marked *