mySQL / MariaDB - Update a users password using the SET PASSWORD statement

by
Jeremy Canfield |
Updated: November 05 2021
| mySQL / MariaDB articles
This assume you are able to log into your MariaDB or mySQL server or you have configured passwordless authentication and will be using the -e command line option. You may want to first SELECT USER to display the list of current users.
Here is one way to change a users password.
alter user 'john.doe'@'localhost' identified by 'new_password';
And here is another way.
UPDATE mysql.user SET Password=PASSWORD('new_password') WHERE User='the_username';
FLUSH PRIVILEGES;
Did you find this article helpful?
If so, consider buying me a coffee over at