mysqladmin -u root -p password NEWPASSWORDEnter the current root password when prompted and replace NEWPASSWORD with the desired password. This should return you to the command prompt, and you can test whether it was successful by logging in:
mysql -u root -p