Last active
April 18, 2019 05:29
-
-
Save wamith/8ef76f5bec7ff0addef1a3d3b72ed2bf to your computer and use it in GitHub Desktop.
Fix MySQL expired password issue
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
# expired MySQL password | |
systemctl stop mysqld | |
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables" | |
systemctl start mysqld | |
# login to the console and change the password | |
mysql -u root | |
UPDATE mysql.user SET authentication_string = PASSWORD('password123') WHERE User = 'root' AND Host = 'localhost'; | |
FLUSH PRIVILEGES; | |
-- set passwords to never expire (optional) | |
SET GLOBAL default_password_lifetime = 0; | |
exit | |
# restart MySQL | |
systemctl stop mysqld | |
systemctl unset-environment MYSQLD_OPTS | |
systemctl start mysqld | |
# try and login with the new password | |
mysql -u root -p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment