Last active
October 21, 2019 05:11
-
-
Save Guley/5334a835cc9a8f9e486f167c3feba534 to your computer and use it in GitHub Desktop.
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
For Ubuntu 18.04 and mysql version 14.14 Distrib 5.7.22 follow the below step to reset the mysql password. | |
Step 1 | |
sudo systemctl stop mysql | |
Step 2 | |
sudo systemctl edit mysql | |
This command will open a new file in the nano editor, which you'll use to edit MySQL's service overrides. These change the default service parameters for MySQL. This file will be empty, so add the following content: | |
[Service] | |
ExecStart= | |
ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid --skip-grant-tables --skip-networking | |
Step 3 | |
sudo systemctl daemon-reload | |
sudo systemctl start mysql | |
Step 4 | |
sudo mysql -u root | |
Step 5 | |
FLUSH PRIVILEGES; | |
Step 6 | |
UPDATE mysql.user SET authentication_string = PASSWORD('new_password') WHERE user = 'root'; | |
Step 7 | |
UPDATE mysql.user SET plugin ='mysql_native_password' WHERE user = 'root'; | |
Step 8 | |
GRANT permission ON database.table TO 'user'@'localhost'; | |
Step 9 | |
sudo systemctl revert mysql | |
and finally | |
sudo systemctl restart mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment