It’s actually pretty simple. Login as root. Stop the mysql process. Then you do SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘newpassword’);
If you save the file as passwordinit then you just start the MYSQL server with the file under the mysqld_safe –init-file=~/passwordinit & command.
Then just reset the server process and your password should be reset.