Log in to mysql
mysql -u root -p 'your current password'
Type the following commands to change the password:
mysql> use mysql;
mysql> update user set password=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit
That’s it.