Did you forget your WordPress admin password and would like to reset it?. In this guide, I’ll show you three ways to reset a forgotten WordPress CMS admin password. The same procedures can be used for other WordPress profile user accounts.
These are the methods you can use to reset WordPress admin password:
- Ret WordPress admin password from MySQL CLI
- Ret WordPress admin password using MySQL phpMyAdmin interface ( Common on Cpanel and other shared hosting platforms)
- Reset WordPress admin password using “Lost your password?” link on the login page
Method 1: Ret WordPress admin password from MySQL CLI
This is the easiest method if you have access to MySQL CLI. Login to mysql database using a user account with the privileges to manage wordpress database.
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8325
Server version: 10.3.9-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Confirm your WordPress database. For me this is wp_db
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| wp_db |
| mysql |
| performance_schema |
+--------------------+
5 rows in set (0.008 sec)
Switch to the database and list tables
MariaDB [(none)]> use wp_db;
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
MariaDB [wp_db]> show tables;
+-----------------------+
| Tables_in_wp_db |
+-----------------------+
| 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 |
| wp_yoast_seo_links |
| wp_yoast_seo_meta |
+-----------------------+
14 rows in set (0.000 sec)
To show the current user hashed password, use:
MariaDB [wp_admin]> select id,user_login,user_pass from wp_users;
+----+------------+-------------------------------------------+
| id | user_login | user_pass |
+----+------------+-------------------------------------------+
| 1 | admin | *BD2AEAC78A6C6B56C3496A341925C581C62E4518 |
+----+------------+-------------------------------------------+
1 row in set (0.001 sec)
Finally, update the password using:
> UPDATE wp_users SET user_pass=MD5('NewPassword') where id=1;
Query OK, 1 row affected (0.014 sec)
Rows matched: 1 Changed: 1 Warnings: 0
You can also use the online md5 Hash Generator or generate hashed password prior to updating it manually.
$ echo "NewPass" > /tmp/pass
$ tr -d '\r\n' < /tmp/pass| md5sum | tr -d ' -'
62e505a5781054d9701d44802c75cba2
Then change it by resetting with the hashed password:
> UPDATE wp_users SET user_pass='62e505a5781054d9701d44802c75cba2' where id=1;
Query OK, 1 row affected (0.014 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Method 2: Ret WordPress admin password from MySQL phpMyAdmin interface
Login to your phpMyAdmin interface.
- Select the database on the left navigation pane.
- Click on the wordpress users‘ table
- Select the user you want to change the password for, click edit
- Select MD5 function for user_pass field and provide a password
- Save changes
Method 3: Reset WordPress admin password using “Lost your password?” link
This only works if you have the username and email address for the admin account. Use the “lost password” WordPress feature.
- Navigate to the WordPress Login page e.g http://mysite.com/wp-login.php)
- Click on the link Lost your password?
- Enter your account email address on the next page.
- A new password will be emailed to you.
- Login with the emailed password and change it to something you can remember.