Created
March 8, 2020 11:33
-
-
Save tayyebi/540c479e963a8a220e562602d29ba9ae 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
## Instructions From: https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost | |
Open & Edit /etc/my.cnf or /etc/mysql/my.cnf, depending on your distro. | |
Add skip-grant-tables under [mysqld] | |
Restart Mysql | |
You should be able to login to mysql now using the below command mysql -u root -p | |
Run mysql> flush privileges; | |
Set new password by ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword'; | |
Go back to /etc/my.cnf and remove/comment skip-grant-tables | |
Restart Mysql | |
Now you will be able to login with the new password mysql -u root -p | |
## SQL Syntax From: https://stackoverflow.com/questions/37879448 | |
use mysql; | |
update user set authentication_string=PASSWORD("") where User='root'; | |
update user set plugin="mysql_native_password" where User='root'; # THIS LINE | |
flush privileges; | |
quit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment