To reset the password for a MySQL user account, you can use the following steps:
- Connect to the MySQL server as the root user:
mysql -u root -p
- Use the following command to reset the password for a specific user account:
SET PASSWORD FOR 'username'@'hostname' = PASSWORD('newpassword');
-
Replace “username” with the actual username and “newpassword” with the desired new password.
-
Exit the MySQL prompt:
exit;
- Restart the MySQL service for the changes to take effect:
sudo service mysql restart
Now you can log in to the MySQL server with the new password.