Created
July 6, 2018 20:48
-
-
Save csymlstd/b7d03213d83446961b9b70eaa661c785 to your computer and use it in GitHub Desktop.
Reset MySQL Password on Ubuntu 16.04
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
# Stop MySQL Service | |
sudo systmctl stop mysql | |
# Make service directory and give permission to mysql to write | |
sudo mkdir /var/run/mysqld | |
sudo chown mysqld: /var/run/mysqld | |
# Start MySQL manually | |
sudo mysqld_safe --skip-grant-tables --skip-networking & | |
# Login | |
mysql -uroot mysql | |
# Update the password | |
UPDATE mysql.user SET authentication_string=PASSWORD('NEWPASSWORD'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost'; | |
EXIT; | |
# Shutdown manual service | |
sudo mysqladmin -S /var/run/mysqld/mysqld.sock shutdown | |
# Restart MySQL | |
sudo systemctl restart mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment