$ mysqladmin -u root password NEWPASSWORDHowever if you want to change (or update) a root password, then you need to use following command:
$ mysqladmin -u root -p oldpassword newpassEnter password: To change a normal user password you need to type (let us assume you would like to change password for eric):
$ mysqladmin -u eric -p oldpassword newpassMethod # 2: MySQL stores username and passwords in user table inside MySQL database. You can directly update password using following method to update or change password for user eric: 1) Login to mysql server, type following command at shell prompt:
$ mysql -u root -p2) Use mysql database (type command at mysql> prompt):
mysql> use mysql;3) Change password for user eric:
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='eric';4) Reload privileges (very important):
mysql> flush privileges; mysql> quitThis method you need to use while using PHP or Perl scripting.