How to change your MySQL User Password

Today I had to admit that I did not remember the password for a MySQL user account. Since it’s saved in encrypted form simply reading it out won’t mean I can recover it. A Google search did eventually bring up the correct way of doing it, however it took me quite some time – so here’s how you can do this:

Login to your MySQL server via the following command:

and enter your MySQL root password. This will get you into the MySQL prompt. First thing we want to do is select the database which holds user accounts (as well as a lot of other important MySQL related information), aptly titled mysql:

You’ll get a message telling you that the database has changed. Now change the password for a given user account using this command:

OK I know this is always cryptic when it’s not explained properly. Let’s assume here that our username is jeff and our new password is thomas. Then your actual command would look like this:

Makes sense, right? Now your password is changed in the database but they haven’t filtered into memory yet. Let’s change that by typing

And voila – your password has been updated. There’s no need to restart the MySQL demon. Exit the MySQL with

and you’re all done.

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

4 thoughts on “How to change your MySQL User Password

    1. You run this command from your SSH prompt. You need to be able to login to MySQL via SSH. If you only have access to phpMyAdmin then you can browse to Privileges, select your user name and change it that way.

Add your voice!