1. Login to mysql server with a user with enough privileges (usually root)

$ mysql -u root -p

2. Select the database ‘mysql’

mysql> use mysql;

3. Modify the password

mysql> update user set password=PASSWORD('new_password') where user='username';

4. Flush privileges

mysql> flush privileges; 

5. Exit the mysql console

mysql> exit