Created
January 14, 2023 17:33
-
-
Save tranduydat/da94ccd5a9e12564fd700557a31a1418 to your computer and use it in GitHub Desktop.
Reset MySQL 8 password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo systemctl stop mysql | |
sudo mysqld_safe --skip-grant-tables & | |
mysql -u root | |
UPDATE mysql.user SET authentication_string=null WHERE User='root'; | |
flush_privileges; | |
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'yourpasswd'; | |
exit; | |
ps -fea | grep mysqld | |
sudo kill -9 [pid from previous command] | |
# Credit: https://stackoverflow.com/questions/50691977/how-to-reset-the-root-password-in-mysql-8-0-11 @Ulises Layera |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment