Days
:
Hours
:
Minutes
:
Seconds

Paragon - Business WordPress Theme $69 $19

View Now
Skip to content Skip to sidebar Skip to footer

How to Reset Your WordPress Password

reset your WordPress password

There are multiple ways to reset your password in WordPress. While the most straightforward method is typically using the “Lost your password?” link on the login page, there are situations—such as issues with your email—where you may need to explore alternative methods.

Here’s a guide on different ways to reset your WordPress password, depending on your access level to your website.

Changing Your Password via the Admin Panel

To change your password through the WordPress admin panel:

  1. Navigate to Users > All Users from the Admin Screen menu.
  2. Find your username in the list and click on it to edit your profile.
  3. Scroll down to the New Password section in the Edit User screen and click the Generate Password button.
  4. You can replace the automatically generated password with one of your choosing by typing it in the provided box. The strength indicator will show you how secure your password is.
  5. Click the Update User button to activate your new password immediately.

Using the Automatic Emailer

If you know your username or the email associated with your account, you can reset your password via email:

  1. Go to your WordPress login page (e.g., http://yoursite.com/wordpress/wp-login.php).
  2. Click on the “Lost your password?” link.
  3. Enter your username or the email address linked to your account.
  4. Wait for your new password to be emailed to you.
  5. Once you receive the new password, log in to your profile and change the password to something more memorable.

Using MySQL Command Line

To reset your password via the MySQL command line, follow these steps to generate an MD5 hash of your new password.

  1. Obtain an MD5 hash of your password:
  • Use an online MD5 hash generator, or
  • Generate it using Python.
  1. For Unix/Linux users:
  • Create a file named wp.txt that contains just your new password.
  • Run the following command:

tr -d ‘\r\n’ < wp.txt | md5sum | tr -d ‘ -‘

  • Delete the file afterward:

rm wp.txt

  1. For Mac OS X users:
  • Similarly, create a file called wp.txt with only your new password. Then, you can use one of the following commands:
    • To print the MD5 hash:

md5 -q ./wp.txt; rm ./wp.txt

  • To copy the MD5 hash to your clipboard:

md5 -q ./wp.txt | pbcopy; rm ./wp.txt

  1. Log in to MySQL:

mysql -u root -p  

  • Enter your MySQL password when prompted.
  1. Select your WordPress database:

use (name-of-database);  

  1. Display the tables:

show tables;  

  • Look for a table name that ends with “users.”
  1. View the user details:

SELECT ID, user_login, user_pass FROM (name-of-table-you-found);  

  1. Update the password:

UPDATE (name-of-table-you-found) SET user_pass = ‘(MD5-string-you-made)’ WHERE ID = (id#-of-account-you-are-resetting-password-for);  

  1. Confirm the password change:

SELECT ID, user_login, user_pass FROM (name-of-table-you-found);  

  1. Exit the MySQL client by pressing Control-D.

Note: If you’re using a recent version of MySQL (5.x or later), you can simplify the process by letting MySQL compute the MD5 hash for you. In this case, skip the first step and use the following command in step 8:

UPDATE (name-of-table-you-found) SET user_pass = MD5(‘(new-password)’) WHERE ID = (id#-of-account-you-are-resetting-password-for);  

 

Even if the passwords are salted (e.g., $P$BLDJMdyBwegaCLE0GeDiGtC/mqXLzB0), you can still replace the password using an MD5 hash, and WordPress will allow you to log in.



Resetting via phpMyAdmin

This guide is intended for users who have access to phpMyAdmin for managing their database. Important: Proceed with caution when using phpMyAdmin. If you’re unsure about how to use it, consider seeking assistance, as WordPress cannot be held liable for any potential data loss.

Start by logging into phpMyAdmin and selecting the “Databases” option.
You will see a list of databases; click on the one associated with your WordPress site.

phpMyAdmin
  • All the tables within your database should be displayed. If they aren’t visible, select “Structure.”
  • Find the wp_users table in the list.
  • Click on the browse icon to view its entries.
  • Search for your username listed under the user_login column.
  • Click the edit option (which might appear as a pencil icon in certain versions of phpMyAdmin).
chngewp3
  • Your user_id will be displayed. Click on the Edit option.
  • Beside user_pass, you’ll see a lengthy string of alphanumeric characters.
  • Highlight and remove this existing string, then enter your desired new password.
  • You can enter the password as you normally would, but keep in mind that it is case-sensitive.
  • For instance, the new password can be set as ‘rabbitseatcarrots.’
  • After entering your new password, locate the dropdown menu and choose MD5 from the options provided.
changepw6
  • Ensure that your password is accurate and that MD5 is selected in the box.
changepw7
  • Press the ‘Go’ button located at the bottom right corner.
  • Then, try logging in with your new password. If you encounter any issues, double-check that you followed the instructions precisely.

Resetting via FTP

You can easily reset your password using FTP if you have access as an admin user.

  • Connect to your site using FTP and download the functions.php file from your active theme.
  • Open the file and insert the following code at the very top, right after the initial <?php tag:

wp_set_password( ‘my_new_password’, 1 );

Be sure to replace my_new_password with your desired new password. The 1 in the code corresponds to the user ID for the main admin account, which is usually set as 1 in the wp_users database table.

  • Re-upload the modified functions.php file back to your site.
  • After successfully logging in, remember to remove that line of code. If you don’t, it will reset your password every time the page loads.

Resetting Your Password with WP CLI

WP CLI is a command-line interface designed for managing your WordPress installation efficiently.

  • Navigate to your /wordpress directory and enter the following command to list all users:

$ wp user list

 

This will display a list of users, allowing you to identify the ID of the user you wish to update.

 

  • To change the password for the desired user, use the following command:

$ wp user update [user_id] –user_pass=’yourNewPassword’

Make sure to replace [user_id] with the actual ID of the user you’re updating and ‘yourNewPassword’ with your new desired password.

Using the Emergency Password Reset Script

If the previous methods haven’t resolved your issue, consider using the Emergency Password Reset Script. Keep in mind that this is not a plugin but a standalone PHP script.

Important Considerations:

  • This script requires you to know the administrator’s username.
  • It will reset the administrator’s password and send a notification to the registered email address.
  • Even if you do not receive the email, the password will still be successfully updated.
  • You need not be logged into your WordPress site to utilize this script. (If you could log in, you wouldn’t need this solution.)

Place the script in the root directory of your WordPress installation, not in the Plugins directory.

For security purposes, be sure to delete the script after you’ve completed the password reset process.

Instructions for Using the Emergency Password Reset Script:

  1. Create the Script File:

Copy the content of the Emergency Password Script and save it in a file named emergency.php located in the root directory of your WordPress installation (this is the same folder that contains the wp-config.php file).

  1. Access the Script:

Open your web browser and navigate to http://example.com/emergency.php (replace example.com with your actual domain).

  1. Enter Your Details:

Follow the on-screen instructions by entering the administrator username (typically “admin”) and your desired new password. Then, click on “Update Options.” You will see a confirmation message indicating that the password has been changed.

  1. Check for Email Notification:

An email will be sent to the blog administrator containing the new password details.

  1. Remove the Script:

Once you have successfully reset your password, delete emergency.php from your server. It is crucial not to leave this script accessible on your server, as others could exploit it to change your password.

For the Updates

Exploring ideas at the intersection of design, code, and technology. Subscribe to our newsletter and always be aware of all the latest updates.

Leave a comment

Download a Free Theme