There are several ways to reset the admin user password in WordPress. A simple method is to change the password after logging into your WordPress admin area.
But what happens when you do not have the current password?
This article lists detailed steps for various methods to reset the WordPress admin user password.
Method – 1
Reset Password when you have the Current Working Password:
These steps can be applied when you have a current admin user password, and you can log in to your WordPress admin area using that password
1. Log into your WordPress admin area using your current password.
2. From the left pane options, click on Users.
It will list all WordPress admin users.
3. Select the one for which you want to change the password and click on the Edit link.
4. Specify the new password and click on Update User
Method – 2
Reset Password using the Password Reset Link:
This method is the easiest option to reset a password when you do not have the current password. You can reset the WordPress admin user password through the Password Reset link by following these steps –
- Open the WordPress admin page (wp-login page) and click on Lost your password? option.
2. Enter your User name or Email address associated with your WordPress admin user.
3. Now, click on Get Password.
4. It will send you an email at the email address specified by that user.
You will have to click on the verification link received in the email, allowing you to set a new password for your user.
Method – 3
Reset Password through phpMyAdmin Interface:
If you don't have access to the email account settings for your admin user or if you cannot receive emails to that account, then you can use this method to reset the password of your WordPress admin user.
1. Log in to phpMyAdmin.
2. Double-click on your WordPress database.
3. Double-click on the wp_users table.
4. Locate your user and click on Edit
5. Enter a new password in the user_pass field and select MD5 from the dropdown menu.
6. Click on Go.
Method – 4
Reset Password using MySQL Command Line (MySQL CLI):
WordPress stores the passwords in a MySQL database so you can update the new password. You need to access the database through My phpAdmin/ MySQL CLI or any other application you use to manage the database. In the method mentioned above, we have seen the steps for phpMyAdmin. Now let us see the steps for MySQL CLI.
1. Open the terminal window in your system.
2. Log in to the MySQL command line (refer to this URL-http://dev.mysql.com/doc/refman/5.6/en/mysql.html for more details) and run the following commands:
use your-wordpress-database;
UPDATE wp_users SET user_pass = MD5(‘Enter-new-password-here’) WHERE ID=1 LIMIT 1;
Notes
- your-wordpress-database should be replaced with your WordPress database name.
- ID is the user ID, ausually1 for the default admin account.
Method – 5
Reset Password using FTP Method:
You must use the FTP method if you do not have access to the database or control panel. Here are the steps for this method –
1. Download the function.php file located under the Themes folder [Active Theme]
2. Add wp_set_password ('Enter-newpassword-here',1)' in the function.php file in the second line after opening a PHP tag.
1 is the user ID, and usually, it is 1 for the default admin account.
3. Upload the modified file back to its original location
4. Try to log in with the new password. You will be redirected to the same page. Nothing will happen.
Don't try to log in again.
5. Again, download the same file, remove the added line, and upload it back to its original location.6. Now, you should be able to log in using a new password.
Method – 6
Reset Password using Password Reset Script:
There is also another method to reset the password when you do not have access to the database or control panel; it is using Password Reset Script by following the steps mentioned below –
- Copy the code from THIS URL.
- Please create a new file, pwreset.php containing the code we copied under the root of your WordPress installation, or you can create it locally and then upload it using an FTP account.
- Open the following URL in your web browser (replace 'www.demowordpress.com' with your website name).
http://www.demowordpress.com/pwreset.php
4. Enter your WordPress username and new password
5. Click on the Update Options button.
Note: It is mandatory to remove the password reset script once you are done with the password reset. In this case, it is pwreset.php.
→ Are you looking to change WordPress admin user through MySQL Database?
Please refer to the following article – Change WordPress Admin User.