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.

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.

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!