Skip to content

Instantly share code, notes, and snippets.

@pritdeveloper
Last active June 18, 2024 06:03
Show Gist options
  • Save pritdeveloper/38ba12fff0632813d762d9929cb5a784 to your computer and use it in GitHub Desktop.
Save pritdeveloper/38ba12fff0632813d762d9929cb5a784 to your computer and use it in GitHub Desktop.
reset root MySQL password

How to reset root MySQL password on Ubuntu

sudo mysql -u root
FLUSH PRIVILEGES;
USE mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
# For older mysql
# UPDATE user SET authentication_string=PASSWORD("Secret#123") WHERE User='root';
# not needed
# UPDATE user SET plugin="mysql_native_password" WHERE User='root';
quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment