How to reset WordPress password at Localhost

In this article I will explain steps to  Recover WordPress Admin password at localhost via phpMyAdmin Interface.
Resetting password at live server of WordPress Self hosted blogs/websites are easy.

What if you forget password of a localhost installation?
To reset password at localhost some manual work needed to be done. 

reset WordPress password wpgyan 1

On localhost installations WordPress Reset password function don’t send a reset e-mail to your e-mail.Since most default localhost server install has not configured to send a e-mail.

 

reset_wordpress_password_wpgyan_2

So, How to deal with it?

Follow these steps to recover Lost Password.

1. Log In to phpMyAdmin Panel

Browse to http://localhost/phpmyadmin/ and enter your Mysql user name and password and click on “Go”.

reset_wordpress_password_wpgyan_3

2. Select the database of WordPress installation

Choose the database of WordPress installation which password need to recover.
if you don’t remember database name then go file directory of WordPress install and look for

in wp-config.php file.In my case database name is ‘wpdir’.

reset_wordpress_password_wpgyan_4

3. Select wp_users Table

In my case prefix is wp_  you may have different prefix. But table name will be yourprefix_users.

reset_wordpress_password_wpgyan_5

Once clicked on users table a list of users will show.Click on ‘Edit’ link of the user whose password you want to reset.
In My case it is ‘Gyanendra’.

reset_wordpress_password_wpgyan_6

4. Change the Password

Once you will click on wp_users table you will see the table structure as show in the picture below.
reset_wordpress_password_wpgyan_7

 

  • a.In user_pass  column select md5 in drowdown.
  • b. Enter the password of your choice in corresponding value field.
  • c. Click on ‘Go’  to save the settings.

Once done browse admin section of your WP website and enter username and password you just changed.
You should be able to Login!

Feel free to comment below or ask question :)

Comments

  1. says

    The ‘admin’ password can be changed by editing the ‘functions.php’ file of your active WordPress theme, which is the fastest and easiest way.

    Open the ‘functions.php’ file and add the following line right after ‘<?php:':

    wp_set_password( 'NewPassword', 1 );

    Replace 'NewPassword' with an actual strong password and '1' with the user ID number.

    Now, log in to the WordPress admin panel using your new password.

    Don't forget to remove the code from the 'functions.php' file after the password is changed.

    • says

      Thanks for comment.

      Yes, It is one of many options to change password for a user.

      In general term:

      wp_set_password( $password, $user_id )

      where:
      $password = new password
      $user_id = user Id

      for ‘admin’ user it look like wp_set_password( NewPassword, 1 )

      PS: For other users apart from ‘admin’ user you again need to find user Id for that particular user.
      Again In that case to find user id, Need to browse database.

      As I have pointed in Point 3. user id can be found under ID.

      Also this code should be deleted once page loaded. otherwise password will be change on each load.

  2. Mohd Javed says

    Thanksyou sir,

    It is very useful for me i forgott my password and not able to reset it.

    Thanks
    Javed

    • Øyvind Trøhaugen says

      In the file wp-config I have changed:

      /** Name for the WordPress-database */
      define(‘DB_NAME’, ‘mydatabasename’);

      /** MySQL-database username */
      define(‘DB_USER’, ‘root’);

      /** MySQL-database password */
      define(‘DB_PASSWORD’, ”);

      I thought it should be possible to login on localhost with the
      username “root” and With blank password…

      Øyvind

  3. menre says

    Thanks a lot. I forgot all my log in details and could not log in again. I was already thinking of how to start redesigning a new theme on a new wordpress installation before I found your post. Much appreciated.

  4. says

    hi i saved my live site in settings/general.
    now i want my localhost back what to do?
    when i open localhost site i redirected to my live site.
    help me please.

Leave a Reply

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