Skip to content

Instantly share code, notes, and snippets.

@kartikm
Last active November 17, 2017 13:08
Show Gist options
  • Save kartikm/7c25096681c47da302e2c07d7e09b7e9 to your computer and use it in GitHub Desktop.
Save kartikm/7c25096681c47da302e2c07d7e09b7e9 to your computer and use it in GitHub Desktop.
How to reset MySQL/Mariadb root password
sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables --skip-networking &
mysql -u root
USE mysql;
UPDATE user SET password=PASSWORD("new_password") WHERE User='root';
UPDATE user SET plugin="mysql_native_password";
exit
sudo /etc/init.d/mysql stop
sudo kill -9 $(pgrep mysql)
sudo /etc/init.d/mysql start
You will be asked to autheticate using your system admin password.
Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment