Skip to content

Instantly share code, notes, and snippets.

@Artistan
Last active April 15, 2020 15:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Artistan/7665d26aabd5f03772f6c0e6769a37ad to your computer and use it in GitHub Desktop.
Save Artistan/7665d26aabd5f03772f6c0e6769a37ad to your computer and use it in GitHub Desktop.
Reset Master (root) MySQL Password -- Digital Ocean
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
flush privileges;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'mypassword';
flush privileges;
exit
# 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