HottestNaija Header Image

Four (4) Easy Ways to Reset WordPress Password

join us on Telegram
Spread the love


Are you locked out of WordPress, because you forgot your password? Such things do happen, and quite common too. Not to worry, in this post, I’ll share with you three quick and easy steps to reset your password in WordPress, and set you back on your feet quickly. 

Method One: Reset Your Password By Using WordPress Password Reset Link

This method is applicable if you still remember, and have access to the email address you registered WordPress with. To reset your password using this method, head on to www.yoursite/wp-admin  and click on the reset password link. Fill in the required details, and follow the instructions to set up your new password.

Method Two: Reset Your Password From Your WordPress Dashboard

This method is applicable where you still have access to your WordPress dashboard, but cannot remember the actual password you used any longer. This is of course possible where you auto saved your login details in your browser. 

But you must not rely on that cos, you may need to login with another device entirely with a different browser. Also, you may lose that auto-login ability when you clear your browser cache and history. 

Unfortunately, you cannot view your password in WordPress even while you’re in the dashboard. But you can view your username, change your password, and reset your password right from within the dashboard.

In order to reset your password within the dashboard in WordPress, you will need to navigate to Users→Your Profile→Account Management→New Password→Generate Password

Click on generate password, under account management

When done, scroll down and click on Update Profile

Method Three: Reset Your Password In MySQL Database

This method will require that you have access to MySQL database via the C panel of your server. In order to reset your password using this method, you must login to your C panel, and click on phpMyAdmin.  

Click on phpMyAdmin to connect to your database

You should then see a list of your databases. Click on ‘connect’  or ‘connect now’ whatever is displayed in your server, in order to connect to the database.

Click on the users table. Your own table prefix may be different from the one shown in the image below

Click on browse, in order to expand the role.

Now, click on the small pencil icon towards the left to open the edit dialog, where you will be able to type in your new password

Delete the old password, input the new one, and change the encryption to MD5. This is supported in lower versions of WordPress, and will be updated if you are using a newer WordPress version.

After all has been set, click on go to apply and save your changes. 
CONGRATULATIONS! You have successfully changed your password from the database.

Method Four: Reset Your Password Using the Emergency Password Reset Script

There are two common methods of doing this, and each entails uploading a PHP  script to your server. There are words of caution to follow however, in applying these methods:
  1. Requires you know the administrator username.
  2. It updates the administrator password and sends an email to the administrator’s email address.
  3. If you don’t receive the email, the password is still changed.
  4. You do not need to be logged in to use it. If you could login, you wouldn’t need the script.
  5. Place this in the root of your WordPress installation. Do not upload this to your WordPress Plugins directory.
  6. Delete the script when you are done for security reasons.
Directions for use 
  1. Save the script as a file called emergency.php to the root of your WordPress installation (the same directory that contains wp-config.php).
  2. In your browser, open
  3. As instructed, enter the administrator username (usually admin) and the new password, then click Update Options. A message is displayed noting the changed password. An email is sent to the blog administrator with the changed password information.
  4. Delete emergency.php from your server when you are done. Do not leave it on your server as someone else could use it to change your password.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

require './wp-blog-header.php';

function meh() {
global $wpdb;

if ( isset( $_POST['update'] ) ) {
$user_login = ( empty( $_POST['e-name'] ) ? '' : sanitize_user( $_POST['e-name'] ) );
$user_pass = ( empty( $_POST[ 'e-pass' ] ) ? '' : $_POST['e-pass'] );
$answer = ( empty( $user_login ) ? '<div id="message" class="updated fade"><p><strong>The user name field is empty.</strong></p></div>' : '' );
$answer .= ( empty( $user_pass ) ? '<div id="message" class="updated fade"><p><strong>The password field is empty.</strong></p></div>' : '' );
if ( $user_login != $wpdb->get_var( "SELECT user_login FROM $wpdb->users WHERE ID = '1' LIMIT 1" ) ) {
$answer .="<div id='message' class='updated fade'><p><strong>That is not the correct administrator username.</strong></p></div>";
if ( empty( $answer ) ) {
$wpdb->query( "UPDATE $wpdb->users SET user_pass = MD5('$user_pass'), user_activation_key = '' WHERE user_login = '$user_login'" );
$plaintext_pass = $user_pass;
$message = __( 'Someone, hopefully you, has reset the Administrator password for your WordPress blog. Details follow:' ). "rn";
$message .= sprintf( __( 'Username: %s' ), $user_login ) . "rn";
$message .= sprintf( __( 'Password: %s' ), $plaintext_pass ) . "rn";
@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] Your WordPress administrator password has been changed!' ), get_option( 'blogname' ) ), $message );
$answer="<div id='message' class='updated fade'><p><strong>Your password has been successfully changed</strong></p><p><strong>An e-mail with this information has been dispatched to the WordPress blog administrator</strong></p><p><strong>You should now delete this file off your server. DO NOT LEAVE IT UP FOR SOMEONE ELSE TO FIND!</strong></p></div>";

return empty( $answer ) ? false : $answer;

$answer = meh();
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<title>WordPress Emergency PassWord Reset</title>
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" />
<link rel="stylesheet" href="<?php bloginfo( 'wpurl' ); ?>/wp-admin/wp-admin.css?version=<?php bloginfo( 'version' ); ?>" type="text/css" />
<div class="wrap">
<form method="post" action="">
<h2>WordPress Emergency PassWord Reset</h2>
<p><strong>Your use of this script is at your sole risk. All code is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness. Further, I shall not be liable for any damages you may sustain by using this script, whether direct, indirect, special, incidental or consequential.</strong></p>
<p>This script is intended to be used as <strong>a last resort</strong> by WordPress administrators that are unable to access the database.
Usage of this script requires that you know the Administrator's user name for the WordPress install. (For most installs, that is going to be "admin" without the quotes.)</p>
echo $answer;
<p class="submit"><input type="submit" name="update" value="Update Options" /></p>

<fieldset class="options">
<legend>WordPress Administrator</legend>
<label><?php _e( 'Enter Username:' ) ?><br />
<input type="text" name="e-name" id="e-name" class="input" value="<?php echo attribute_escape( stripslashes( $_POST['e-name'] ) ); ?>" size="20" tabindex="10" /></label>
<fieldset class="options">
<label><?php _e( 'Enter New Password:' ) ?><br />
<input type="text" name="e-pass" id="e-pass" class="input" value="<?php echo attribute_escape( stripslashes( $_POST['e-pass'] ) ); ?>" size="25" tabindex="20" /></label>

<p class="submit"><input type="submit" name="update" value="Update Options" /></p>
<?php exit; ?>
The above code is available here
Another code similar to the one given above, is a script written by Nicolas Kuttler, a software and systems engineer from France, available at his website.
A snapshot of the code is given below:
$user_id = 1; # Insert your user ID or simply 1 for the first user that was created
$user_pass = 'secret'; # Insert a new password
$ip = ''; # Insert your IP

if ($_SERVER['REMOTE_ADDR'] === $ip) {
require_once(ABSPATH . WPINC . '/registration.php');
require_once(ABSPATH . WPINC . '/pluggable.php');
$user = wp_update_user(array(
'ID' => $user_id,
'user_pass' => $user_pass,
)) ;
die('disable me!');
According to Nicolas, in order to use this code, you have to edit it, and fill in the proper values. Then upload it to the wp-content/mu-plugins/ directory, create the directory if necessary.
The code will run automatically, there’s no need to activate it like a plugin, but you have to delete the file after using it.
The script may also fail if there is no user with an ID of 1.

This code will run automatically by going to your website, and must be uploaded to the wp-content/mu-plugins/ directory, even if you are not using multi-user. The code does not need to have a specific name on the server.

Another version of the script that he wrote which must also be uploaded to the wp-content/mu-plugins/ directory is given below. You need ftp access to your host to upload these scripts.

* Upload to wp-content/mu-plugins/whichevernameyoulike.php
$login = 'foobar'; # New username
$password = 'barbaz'; # Password for the new user
$email = '[email protected]'; # Email address of the new user
$ip = ''; # Insert your IP,

if ($_SERVER['REMOTE_ADDR'] === $ip) {
require_once(ABSPATH . WPINC . '/pluggable.php');
require_once(ABSPATH . 'wp-admin/includes/' . 'user.php');

$userdata = array(
'user_login' => $login,
'user_pass' => $password,
'user_email' => $email,
'role' => 'administrator',
$user_id = wp_insert_user($userdata);
die('delete me!');

For the code to work, you must insert the necessary details, including your IP Address.
To learn more about this code, follow the link below

I hope these methods help you resolve your password issue successfully in WordPress, if so, share your comments below, and what method you used to resolve the issue

RELATED  Download Mp3:- Chukwuemeka I Will Live by Faith [+ Lyrics]

Spread the love

Leave a Reply

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