Reset MySQL root password in Ubuntu


Here are quick steps to reset mysql root password in Ubuntu

1. Stop the mysql service instance by

1
sudo service mysql stop

2. Start mysqld daemon

1
2
sudo mkdir -v /var/run/mysqld && sudo chown mysql /var/run/mysqld
sudo mysqld –skip-grant-tables &

3. Login as root

1
2
3
mysql -u root
UPDATE mysql.user SET authentication_string=PASSWORD(‘YOURPASSWORD’), plugin=’mysql_native_password’ WHERE User=’root’ AND Host=’localhost’;
FLUSH PRIVILEGES;

4. Kill the service and start

1
2
sudo killall -9 mysqld
sudo service mysql start

Done, now you can login with a new password as root


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.