First, you need to SSH into the host from which you will be connecting to mysql.
Next, you want to make a backup copy of your ~/.mysql_history file (if it exists) so that you don't lose your command history in mysql:
Next, you'll want to start the mysql client:
To change your password once inside the mysql client:
The password inside the quotes is the new password. If you get an error when executing "flush privileges", ignore it.
Next, do the following to get rid of your mysql command history (as your password is stored in plain text there after you execute this command):
The shred command fills the file with nonsense so that it's harder (maybe impossible?) to recover the password from it.
After you've removed the mysql_history file, do the following to restore your backup (if it exists):