How to reset WordPress admin/users password from Linux command line?

WordPress reset password options..

We know how it can be done via PhpMyAdmin option in cPanel. We already discussed this in one of the previous post! Please check this post first, if you have a PhpMyAdmin panel and you’re comfortable with that..

How to reset WordPress admin password from cPanel?

here are many ways to reset the WordPress admin password. We can reset the WordPress admin password from WordPress admin panel as well as cPanel-PHPMyAdmin.

We all know how to reset the wp-admin password from the WordPress Dashboard. It is time that every WordPress blogger knew how to reset the WordPress admin password from PHPMyAdmin. Read more..

It’s simple.

We can change the WordPress users (Admin and other users) password in many ways.

  •  From WordPress dashboard.
  •  Via PhpMyAdmin in cPanel. [Explained above]
  •  From MySQL command prompt.

The first option is simple. If you know the current password go ahead and reset it from WordPress dashboard. This can be done from profile section.

We already discussed the second option. Please see the above link.

Here we go with the third option. Reseting WordPress users password from MySQL command prompt. It’s simple. Please do follow the steps explained below:

1, Log into server as root.

2, Enter to MySQL command prompt.

[root@vps ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 265
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


3, Use WordPress database.

You can check the database name from the WordPress configuration file.

mysql> use user_images;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

4, Verify user details from “wp_users” table.

We need to select only the following details from “wp_users” table.

mysql> SELECT ID, user_login, user_pass FROM wp_users;
| ID | user_login | user_pass                          |
|  1 | admin      | $P$BjUKUieEYT1B3TnkQHsv4Y8hfnSK5t. |
1 row in set (0.00 sec)


This WordPress has only one user “Admin”. The password displayed here isn’t real, it’s in MD5 encrypted format.

5, Updating user password.

This is the point that we are looking for. As I mentioned, the password displayed is in MD5 format. In latest MySQL versions we can generate the password in MD5 format from the commandline itself. Please see the syntax:

mysql> UPDATE wp_users SET user_pass = MD5(‘WPEXPLORER’) WHERE ID=1 LIMIT 1;

In previous versions we have to enter the password in MD5 format. It’s simple, we can generate it from here >> MD5 <<

Syntax to change the password

mysql> UPDATE wp_users SET user_pass = "61250b88abfe298f2df4821d081a3add"  WHERE ID=1;

Here the user pass in MD5 format.

See the updated password:

mysql> SELECT ID, user_login, user_pass FROM wp_users;
| ID | user_login | user_pass                        |
|  1 | admin      | 61250b88abfe298f2df4821d081a3add |
1 row in set (0.00 sec)


Screenshot from 2015-04-25 19-55-07

That’s it!! Now try to login with the new password.

Related posts

1, How to find the WordPress version from command line.
2, Top 10 WordPress themes for web hosting companies
3, 10+ WordPress Web-hosting themes and templates – Demo and download

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

11 thoughts on “How to reset WordPress admin/users password from Linux command line?

  1. Just had to change my WordPress password using ssh, as I had no other way, and this worked a treat. Nice and clear. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *