#coding

recover mysql password on localhost

June 4, 2006

hach, the powers of beeing superuser. Lost your database password? No big deal:


> /etc/init.d/mysql stop
> mysqld_safe --skip-grant-tables &
> mysql
mysql: use mysql;
mysql: update user set password=password('secret') where user='root';
mysql: quit;
> killall mysqld_safe
> /etc/init.d/mysql start
> mysql -u root -p
Enter password: secret
Welcome to the MySQL monitor. ....
mysql:

and off you go.
have fun

share this: