Last active
April 15, 2020 15:47
-
-
Save Artistan/7665d26aabd5f03772f6c0e6769a37ad to your computer and use it in GitHub Desktop.
Reset Master (root) MySQL Password -- Digital Ocean
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
service mysql stop | |
mkdir -p /var/run/mysqld | |
chown mysql:mysql /var/run/mysqld | |
/usr/bin/mysqld_safe --skip-grant-tables --skip-networking & | |
# do the reset.sql stuff... | |
killall mysql ## ps ax|grep mysql -- you may have to list them with this and manually kill them!! :) | |
service mysql start |
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
flush privileges; | |
ALTER USER 'root'@'localhost' IDENTIFIED BY 'mypassword'; | |
flush privileges; | |
exit |
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
# in ~/.my.cnf | |
[client] | |
user=root | |
password=mypassword | |
# now I can log in with just `mysql` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment