Skip to content

Instantly share code, notes, and snippets.

@chrissuperduper
Created May 28, 2016 04:50
Show Gist options
  • Save chrissuperduper/4bc7b907840a7ba7fb0ee1bb4ad88f44 to your computer and use it in GitHub Desktop.
Save chrissuperduper/4bc7b907840a7ba7fb0ee1bb4ad88f44 to your computer and use it in GitHub Desktop.
How to reset the root password for mysql:
Stop mysql:
1. service mysql stop
Run mysql with skip grants to be able to login without any password
2. mysqld_safe --skip-grant-tables &
Login as root
3. mysql -u root
4. mysql commands:
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD-HERE") where User='root';
mysql> flush privileges;
mysql> quit
Stop mysql
5. service mysql stop
Start mysql normally:
6. service mysql start
Try to login using your new password:
7. mysql -u root -p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment