mysql> use mysql; mysql> update user set password=password("new-password") where user = "root"; mysql> flush privileges;
You may accomplish the same task with mysqladmin MySQL command.
$ mysqladmin -u root password 'new-password'
If you wish to change existing root password, you'll use the following command instead. When entered, you'll be prompted for current root password.
$ mysqladmin -u root -p password 'new-password'
NOTE: You do not have to run “flush privileges” MySQL command to reload the privileges when you use “mysqladmin” command.