When you forgot the mysql root password and can not log in to change the password.
Use sudo or root
- You must first stop the mysql server
- Then you need to start the server in safe mode
While running, DO NOT press control- {c, d, z}
- Now, open a new tab in the terminal, or a new terminal and enter MySQL
- And then change the MySQL root password
- Okay, now just restart the MySQL server and login with the new password you used.
After giving Ctrl + Z on the previous tab and kill the process, or simple exit and close the corresponding terminal or tab.
Enjoy!
mysql
Marcos Oliveira
Software developer