MySQL reset password for user account

To reset the password for a MySQL user account, you can use the following steps:

  1. Connect to the MySQL server as the root user:
 
mysql -u root -p
  1. Use the following command to reset the password for a specific user account:
 
SET PASSWORD FOR 'username'@'hostname' = PASSWORD('newpassword');
  1. Replace “username” with the actual username and “newpassword” with the desired new password.

  2. Exit the MySQL prompt:

exit;
  1. 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.

Leave a Comment