How to change Root password in MySQL Server - MySQL DBA Tutorial

Change password for root user in MySQL Server

Scenario:

You are working as MySQL Server DBA and you need you change the password for root. How would you do that?

Solution:

You can use mysqladmin command to change the password for root user. use below statement to change the password

shell > sudo mysqladmin -u root -p password mynewpassword

Once you will hit enter, you will be asked to provide old password for root. Provide the password for root and hit Enter. 

You are all set to login to MySQL Server by using new root password. Use below command to login to MySQL Server.


shell> mysql -u root -p
provide new password, in my case it was mynewpassword. 



MySQL Server Tutorial - How to reset root user password in MySQL installed on Windows



MySQL Training for beginners - How to change root user password for MySQL Server on Linux