Lost MySQL root password?
From Kolmisoft Wiki
Jump to navigationJump to search
Ok, if this is your only problem this little trick will show how to recover your root password.
Proceed as follows.
- Stop the db engine
/etc/init.d/mysql stop
- Restart the daemon
/usr/bin/mysqld_safe –skip-grant-tables &
- Go to the MySQL interactive command
mysql -h your_hostname mysql
- Change the password with the GRANT command
GRANT ALL PRIVILEGES ON * to root@localhost IDENTIFIED BY ‘passwd’; FLUSH PRIVILEGES;
Maybe it should be better to flush privileges from mysqladmin:
mysqladmin -h localhost flush-privileges
That’s it. Now try to login as usual.
Pasted from: http://www.karkomaonline.com/index.php/2003/08/10/lost-mysql-root-password/