Change mysql password from terminal

 

Set the MySQL Root password
mysqladmin -u root password “newpassword”
mysqladmin -u root -h host_name password “newpassword”


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

Change MySQL password for other users

 mysqladmin -u nitish -p oldpassword password newpass

Login to mysql server, type the following command at shell prompt:

mysql -u root -p