How to reset MySQL root password in Ubuntu Linux

In case you have forgotten your root password on your Ubuntu Linux, here’s a small tip on how to reset it.

$ sudo mysqld –skip-grant-tables &

$ mysql -u root mysql

$ mysql> UPDATE user SET Password=PASSWORD(’MyNewPasswordHere’) WHERE User=’root’;

$ mysql> FLUSH PRIVILEGES;

$ mysql> \q

$ sudo /etc/init.d/mysql restart

Now you can login using your new root password.

Comments

2 Responses to “How to reset MySQL root password in Ubuntu Linux”

  1. Andrej on January 27th, 2008 11:53 pm

    Oh my! Thanks for this simple guide I’m bookmarking it :-)

    I use postgres regularly and I’m totally dumb with mysql commands during the occasional use!

  2. Arstan on January 31st, 2008 12:53 am

    Postgres is way to go! Although its kinda advanced

Leave a Reply

You must be logged in to post a comment.

Categories


Clicky Web Analytics