Created
October 26, 2019 23:12
-
-
Save gggordon/939661534db7918e1723641f47beb4d1 to your computer and use it in GitHub Desktop.
Reset MYSQL 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
#!/usr/bin/env bash | |
# Resetting mysql default password | |
NEW_PASSWORD='password' | |
su root | |
systemctl stop mysqld | |
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking" | |
echo "FLUSH PRIVILEGES;ALTER USER 'root'@'localhost' IDENTIFIED BY '$NEW_PASSWORD';" > refresh_user.sql | |
mysql -uroot < refresh_user.sql | |
rm refresh_user.sql | |
systemctl unset-environment MYSQLD_OPTS | |
systemctl restart mysqld |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment