MySQL Reset Root Password
To reset the root password in MySQL, you can follow the steps below:
- Stop the MySQL service:
sudo service mysql stop - Start MySQL in safe mode:
sudo mysqld_safe --skip-grant-tables --skip-networking & - Connect to the MySQL server:
mysql -u root - At the MySQL prompt, enter the following commands:
use mysql; update user set authentication_string=PASSWORD("new_password") where User='root'; flush privileges; quit;Note: Replace "new_password" with the desired new password.
- Stop the MySQL service:
sudo service mysql stop - Start MySQL normally:
sudo service mysql start
