Skip to content

Instantly share code, notes, and snippets.

@wjn
Last active January 3, 2016 20:39
Show Gist options
  • Save wjn/0b52dee091a40be6d6be to your computer and use it in GitHub Desktop.
Save wjn/0b52dee091a40be6d6be to your computer and use it in GitHub Desktop.
Reset MySql Root Password
sudo service mysql stop
sudo killall -vw mysqld
## write stdout and stderr to resetMySql file
sudo mysqld_safe --skip-grant-tables >resetMySql 2>&1 &
## updates the password for root to whatever you enter in place of **NEW_PASSWORD**
sudo mysql mysql -e "UPDATE user SET Password=PASSWORD('**NEW_PASSWORD**') WHERE User='root';FLUSH PRIVILEGES;"
sudo killall -v mysqld
## Restart MySql Service
sudo service mysql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment