Oops! I’ve forgotten MySQL root password.

1)Stop MySQL instance (if it is running)

sudo service mysql stop

2)Startup MySQL instance manually with option –skip-grant-tables and –skip-networking

sudo mysqld_safe --skip-grant-tables  --skip-networking 

3)While MySQL is running from step 2, login to MySQL

mysql --user=root mysql 

4)Execute the following SQL commands to update root password

Update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;

5)Remember to stop MySQL instance executed from step 2 after you complete step 4. Lastly run MySQL normally.

sudo service mysql start
Share →

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Set your Twitter account name in your settings to use the TwitterBar Section.