Created
July 5, 2020 01:50
-
-
Save javascripto/8b16dcc7da5a62395a5b04ac7181a63d to your computer and use it in GitHub Desktop.
Steps to reset mysql password
This file contains hidden or 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
| sudo /etc/init.d/mysql stop | |
| sudo mkdir -p /var/run/mysqld | |
| sudo chown mysql:mysql /var/run/mysqld | |
| cat << EOF > reset.sql | |
| use mysql; | |
| update user set authentication_string=password('') where user='root'; | |
| rupdate user set plugin="mysql_native_password" where User='root'; | |
| flush privileges; | |
| quit; | |
| EOF | |
| sudo mysqld_safe --skip-grant-tables & | |
| sudo mysql -u root << reset.sql | |
| rm reset.sql | |
| sudo /etc/init.d/mysql stop | |
| sudo /etc/init.d/mysql start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment