To change the password of any MySQL user, please login to MySQL with the user have right permission to change the data in the database.
Here, I will use the root account:
1 |
mysql -u root -p |
Enter and then enter the password.
By default, all user information is stored in the mysql database, which is created by default when you install MySQL.
Now, we will announce the mysql database:
1 |
USE mysql |
And use the UPDATE statement to update the password for the user you want:
1 |
UPDATE user SET password=PASSWORD('test123!') WHERE user='testuser'; |
Finally, we need to run the following statement for our changes to take effect:
1 |
FLUSH PRIVILEGES; |