Reset lost mysql root password

Thursday, 21. September 2006

I recently ran across a mysql database I needed to do some work on only the root password didn’t seem to be recorded anywhere. On goes the hunt for password recovery solutions and here is what I found that did the trick.

# /etc/init.d/mysql stop
# mysqld_safe –skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
# mysql -u root -p

Post to Twitter

Leave a Reply

 
Theme Tweaker by Unreal