How to Change MySQL User Password
To change the password of an existing MySQL user, you'll need to log into the MySQL server and run the ALTER USER
command. Let's go through each step.
Step 1
From the terminal log into the MySQL server as root
, supplying any required passwords:
mysql -u root -p
Step 2
Now run the following command, replacing user_name
with your username and NEW_USER_PASSWORD
with your password:
ALTER USER 'user_name'@'localhost' IDENTIFIED BY 'NEW_USER_PASSWORD';
Step 3
Now flush privileges to ensure the changes are applied.
FLUSH PRIVILEGES;