Created
September 22, 2017 15:57
-
-
Save darrenterhune/ec37c2be156b105df69619eea1bf07f0 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
# Found from https://coderwall.com/p/j9btlg/reset-the-mysql-5-7-root-password-in-ubuntu-16-04-lts | |
# Stop MySQL | |
sudo service mysql stop | |
# Make MySQL service directory. | |
sudo mkdir /var/run/mysqld | |
# Give MySQL user permission to write to the service directory. | |
sudo chown mysql: /var/run/mysqld | |
# Start MySQL manually, without permission checks or networking. | |
sudo mysqld_safe --skip-grant-tables --skip-networking & | |
# Log in without a password. | |
mysql -uroot mysql | |
UPDATE mysql.user SET authentication_string=PASSWORD('YOURNEWPASSWORD'), plugin='mysql_native_password' WHERE User='root' AND Host='%'; | |
EXIT; | |
# Turn off MySQL. | |
sudo mysqladmin -S /var/run/mysqld/mysqld.sock shutdown | |
# Start the MySQL service normally. | |
sudo service mysql start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment