It happened, I forgot a password. I normally pride myself on my memory for things like passwords but this one was gone so I went searching for a way to reset it. I found this very concise entry at debian-administration.org that sorted me out. There were many others like it but this is the one that I followed to reset the password (it’s also written by a guy that works for the hosting company I use, Bytemark)
In short my own version of the process:
- Stop the MySQL process.
- Start MySQL manually with the –skip-grant-tables parameter.
/usr/bin/mysqld_safe --skip-grant-tables &
- Run MySQL from the command line, logging in as root with no password.
mysql --user=root --pass mysql
- Update the user table, setting the root user’s password.
UPDATE User set Password=PASSWORD('newpass') WHERE User = 'root';
- Flush the privileges cache.
- Exit MySQL.
- Restart the MySQL service without skipping the privileges tables.
/etc/init.d/mysql stop && /etc/init.d/mysql start