@domenico
To reset a user password in MySQL 8, you can follow these steps:
- Log in to MySQL with an account that has administrative privileges.
mysql -u root -p
- Once you are logged in, switch to the MySQL system database:
use mysql;
- Run the following command to update the user's password:
ALTER USER 'username'@'localhost' IDENTIFIED BY 'new_password';
Replace 'username' with the actual username for which you want to reset the password and 'new_password' with the desired new password.
- If the user is not restricted to localhost only and can access from any host, use the following command instead:
ALTER USER 'username'@'%' IDENTIFIED BY 'new_password';
- After executing the command, you need to flush the privileges so that the changes take effect:
FLUSH PRIVILEGES;
- Exit the MySQL prompt by typing:
exit;
The user's password should now be reset to the new password you provided.