Created
April 19, 2013 11:07
-
-
Save sathishmanohar/5419673 to your computer and use it in GitHub Desktop.
Instructions to reset lost mysql root password on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Stop Mysql | |
sudo /etc/init.d/mysql stop | |
#Start Mysql in safe mode, but skip user privileges table | |
sudo mysqld_safe --skip-grant-tables & | |
#Login to mysql | |
mysql -u root | |
#Select mysql db | |
use mysql; | |
#Reset Password | |
update user set password=PASSWORD("mynewpassword") where User='root'; | |
#Flush the privileges | |
flush privileges; | |
#Quit out | |
quit | |
#Stop Mysql | |
sudo /etc/init.d/mysql stop | |
#Start Mysql | |
sudo /etc/init.d/mysql start | |
#Try logging in | |
mysql -u root -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment