Lost MySQL root password?

From Kolmisoft Wiki
Revision as of 21:38, 10 December 2007 by Admin (talk | contribs) (New page: 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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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/