How to recover the MySQL root password?

~ 0 min
11-02-2010 20:58

Well, this happens from time to time and is actually easy to fix, so here you are:

/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables & mysql -u root
you should now be in the MySQL shell as user root, now we just set a new password for the user root:

update mysql.user set password=PASSWORD("PASSWORD") where user='root'; quit

should be back to the command line, lets restart MySQL:
/etc/init.d/mysql restart

Well, that´s it :)

Average rating 0 (0 Votes)

You cannot comment on this entry