In GNU/Linux:
$ sudo mysqld_safe --skip-grant-tables & $ mysql -u root -p #press enter to use a blank password mysql> use mysql; mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root'; mysql> flush privileges; mysql> quit; $ sudo service mysql stop $ sudo service mysql start #try your new password $ mysql -u root -p
In Mac OS X with MySQL installed with MacPorts:
$ sudo /opt/local/lib/mysql5/bin/mysqld_safe --skip-grant-tables & $ mysql -u root -p #press enter to use a blank password mysql> use mysql; mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root'; mysql> flush privileges; mysql> quit; $ sudo port unload mysql5 $ sudo port load mysql5 #try your new password $ mysql -u root -p
Perfecto!!!