How to Change MySQL User Password

We can change MySQL User Password by using three methods.

1. Alter User Method
2. SET PASSWORD method.
3. Update User method.(This method deprecated from 8.0.11 onwards)

Change MySQL User Password Examples:

1. Create a MySQL User:

CREATE USER amith IDENTIFIED BY 'Amith@321';

2 .Change Password by using Alter User Method:

ALTER USER amith IDENTIFIED BY 'Amith$321'; flush privileges;

3. Change Password by using SET PASSWORD Method.

SET PASSWORD for amith='Amith$234'; flush privileges;

4. Change MySQL User Password using Update user method.

UPDATE mysql.user SET Password=PASSWORD('new-password-here') WHERE USER='user-name-here' AND Host='host-name-here'; flush privileges;

Commands on MySQL Shell:

Video link for the same: