Reset admin password WordPress

Introduction

In this tutorial, I have lost the admin password WordPress. How to reset admin password WordPress.

How to reset admin password WordPress

Login MySQL server and select your database, For Example, I will use wordpressdb database.

[root@server1 ~]# mysql -u root -p
mysql> show databases;
mysql> use wordpressdb;

The output as below

[root@server1 ~]# mysql -u root -p

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| wordpressdb        |
+--------------------+
5 rows in set (0.01 sec)

mysql> use wordpressdb;
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
mysql> 

Find the user table:

mysql> show tables;

The output is as below:

mysql> show tables;
+-----------------------+
| Tables_in_wordpressdb |
+-----------------------+
| wp_commentmeta        |
| wp_comments           |
| wp_links              |
| wp_options            |
| wp_postmeta           |
| wp_posts              |
| wp_term_relationships |
| wp_term_taxonomy      |
| wp_termmeta           |
| wp_terms              |
| wp_usermeta           |
| wp_users              |
+-----------------------+
12 rows in set (0.00 sec)

Find users

mysql> SELECT ID, user_login, user_pass FROM wp_users;

The output as below

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

The administrator is usually user number 1:

mysql> SELECT * FROM wp_users where id = '1';

The output is as below:

mysql> SELECT * FROM wp_users where id = '1';
+----+------------+------------------------------------+---------------+--------------------+------------------------+---------------------+---------------------+-------------+--------------+
| ID | user_login | user_pass                          | user_nicename | user_email         | user_url               | user_registered     | user_activation_key | user_status | display_name |
+----+------------+------------------------------------+---------------+--------------------+------------------------+---------------------+---------------------+-------------+--------------+
|  1 | admin      | $P$B3jZNrepdkZBm9NkkgtnfyaT7ECXWl0 | admin         | pvhuu285@gmail.com | http://192.168.122.229 | 2020-09-04 04:11:59 |                     |           0 | admin        |
+----+------------+------------------------------------+---------------+--------------------+------------------------+---------------------+---------------------+-------------+--------------+
1 row in set (0.00 sec)

For MySQL 5 and higher, just execute a query like this to reset password for admin WordPress

mysql> UPDATE wp_users SET user_pass = MD5 ('123456789') WHERE ID = '1';

Check again

mysql> SELECT * FROM wp_users where id = '1';

The output is as below:

mysql> SELECT * FROM wp_users where id = '1';
+----+------------+------------------------------------+---------------+--------------------+------------------------+---------------------+---------------------+-------------+--------------+
| ID | user_login | user_pass                          | user_nicename | user_email         | user_url               | user_registered     | user_activation_key | user_status | display_name |
+----+------------+------------------------------------+---------------+--------------------+------------------------+---------------------+---------------------+-------------+--------------+
|  1 | admin      | $P$BaDO1CjqaJhGcYKwsk0va7dlAj5cXp. | admin         | pvhuu285@gmail.com | http://192.168.122.229 | 2020-09-04 04:11:59 |                     |           0 | admin        |
+----+------------+------------------------------------+---------------+--------------------+------------------------+---------------------+---------------------+-------------+--------------+
1 row in set (0.00 sec)

We login through wp-login.php and input a new password, as usual.

http://192.168.122.229/wp-login.php

Conclusion

You have Reset admin password WordPress. I hope will this your helpful. Thank you for reading the DevopsRoles page!

, ,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.