Sometimes the simplest sysadmin tasks are the hardest to find straightforward answers to. Recently, I spent too much time trying to change the root password on a fresh mysql install.

Changing the root password for MySQL has security implications; there is no shortage of paranoid nerds describing how the world might end if you do what I’m about to do. If you understand the security implications of setting the root MySQL password, and still want to do it anyway, here’s how:

mysql -uroot

And, once logged in to the mysql console:

UPDATE mysql.user SET Password=PASSWORD('the password goes here') WHERE User='root';