How to Recover a Lost MySQL Password

In: Aashish| MySQL| Security

20 Feb 2010

Article by Aashish

This article explains the process that will allow you to recover a lost MySQL password:

Stop the MySQL server process

Start the MySQL (mysqld) server/daemon process with the
–skip-grant-tables option so that it will not prompt for password.

Connect to mysql server as the root user.

Setup new mysql root account password.

Exit and restart the MySQL server.

Example:

# service mysqld stop

Output:

Stopping MySQL database server: mysqld.

Then start MySql in safe mode

# mysqld_safe –skip-grant-tables

Output

[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql

Then connect the mysql without any password

# mysql -u root

( Then setup password )

mysql> use mysql;

mysql> update user set password=PASSWORD(”NEW-ROOT-PASSWORD”) where User=’root’;

mysql> flush privileges;

mysql> quit

Then stop mysql

# service mysql stop

# service mysql start

Then Try your new password :

# mysql -u root -p

Good Luck!

Share and Enjoy:

  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Live
  • MySpace
  • Netvibes
  • Reddit
  • Slashdot
  • SphereIt
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • Yahoo! Bookmarks

Related Posts:

  • No Related Posts

Comment Form

Recent Posts

  • longchamp: nordstrom http://jmultipleir-djjq.04FORDPARTS.US/tag/nordstrom+longchamp+purses/ : purses.. [...]
  • r2: r2 http://eavedaspaxf.AUTOPARTSVILLE.INFO/tag/r2+Sap+Aveda/ : Sap... Aveda... [...]
  • price: Microwave http://aemersonw0mq76.BEDROOMPROPERTY.INFO/tag/price+Emerson+Microwave/ : Emerson [...]
  • projection: projection http://aprojectionvbt-i0.03GMCPARTS.US/tag/projector+projection+TV/ : projector. [...]
  • Perfume: Perfume http://dnurserywclsbf.bestpartsstore.info/tag/pictures+Perfume+givenchy/ : Perfume. [...]