Skip to content

Instantly share code, notes, and snippets.

@sumanthkumarc
Last active August 18, 2016 08:17
Show Gist options
  • Save sumanthkumarc/def6bbf6a9cc0ca034f25d2ef311f683 to your computer and use it in GitHub Desktop.
Save sumanthkumarc/def6bbf6a9cc0ca034f25d2ef311f683 to your computer and use it in GitHub Desktop.
resetting a mysql root pass(Assuming Ubuntu and new mysql version)
# Stop running myslq server
sudo /etc/init.d/mysql stop
#Restart mysql server in safe mode with no grant table(no security)
sudo mysqld_safe --skip-grant-tables &
#Login to muysql as root
mysql -uroot
#Change to mysql database
use mysql;
#Change user password for root
update user set authentication_string=PASSWORD('mynewpassword') where user='root';
#Flush provileges and then quit
flush privileges;
quit;
#Restart the mysql server
sudo /etc/init.d/mysql start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment