Created
January 4, 2021 15:39
-
-
Save tsleite/1a4bc1d47dddb2309ebd9a8b720b5502 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
$PWD="<PASSWORD>" | |
systemctl stop mysqld | |
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --user=mysql" | |
systemctl restart mysqld | |
mysql -u root -e " \ | |
flush privileges; \ | |
ALTER USER 'root'@'localhost' IDENTIFIED BY '$PWD'; \ | |
flush privileges; \ | |
quit; " \ | |
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
Reset password Mysql