Three methods to retrieve the WP administrator password

WordPress Forgot Password _ Three Methods for Administrator to Retrieve Password

use WordPress installation After finishing the website, it is inevitable to encounter Forgot password The situation. There is no way to retrieve the administrator account by forgetting the password, so it can only use another way. This article introduces Three simple ways to retrieve the WordPress administrator password.

FTP Modify functions.php Retrieve

If you remember the FTP information of your website, you can use FTP software to modify the functions.php file in the theme folder to modify the password.

The specific steps to modify the password through the functions.php file are as follows:

  1. Log in to the server using FTP software.
  2. Enter the theme folder of your website. *
  3. Download the functions.php file and open it with a text editor. *
  4. stay <? php Add after wp_set_password( 'password', 1 ); preservation. *
  5. Upload the modified functions.php file.
  6. Visit the website. The password is the password in the code added above
  7. Delete the code added in the functions.php file.

Tips from the father:

Theme folder location in /wp-content/themes/ The folder under the folder can be viewed through the source code of the website.

The notepad provided with Windows may be garbled when opened. It is recommended to use professional text editing software such as Notepad++to open it.

Password is the password you want to change. 1 is the ID of your administrator account. If your website has multiple administrator users, you need to check the corresponding ID value in the database.

Use reset script to retrieve

If you can upload files to the server, you can use the following method to reset the administrator password with a script. The specific steps are as follows:

  1. Connect to the server using FTP software.
  2. Switch to the root directory of your website( wp-config.php Folder)
  3. Upload the emergency.php File to the site root directory.
  4. Access from browser Your website/emergency.php
  5. Enter the administrator user name and new password as prompted to update.
  6. Password modified successfully, delete emergency.php File.

Reset Script Download

The contents of the reset script are as follows:

 <? php /* 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 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 user name.</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:' ). "\r\n"; $message  .=  sprintf( __( 'Username: %s' ), $user_login ) .  "\r\n"; $message .=  sprintf( __( 'Password: %s' ), $plaintext_pass ) .  "\r\n"; @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 facade'><p><strong>Your password has been successfully changed</strong></p><p><strong>The email containing this information has been sent to the WordPress blog administrator</strong></p><p><strong>Now delete this file from the server to avoid other people's access.</strong></p></div>"; } } return empty( $answer ) ?  false : $answer; } $answer = meh(); ?> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <html xmlns=" http://www.w3.org/1999/xhtml "> <head> <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" /> </head> <body> <div class="wrap"> <form method="post" action=""> <h2>WordPress Emergency Password Reset</h2> <p><strong>Use this script at your own risk. All codes are provided "as is" without any express or implied guarantee of accuracy and completeness. In addition, I will not be responsible for any loss that may be caused by using this script, whether direct, indirect, special, accidental or consequential</ strong></p> <p>This script is intended to be used as a last resort by WordPress administrators who cannot access the database. Using this script requires that you know the administrator user name of the WordPress installation</ p> <? php 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 administrator user name: ')?>< 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> <fieldset class="options"> <legend>Password</legend> <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> </fieldset> <p class="submit"><input type="submit" name="update" value="Update Options" /></p> </form> </div> </body> </html> <? php exit; ?>

Change the password directly in the database

If you remember the password of the database, you can directly log in to the database through phpmyadmin to modify it. The specific steps are as follows:

  1. Log in to phpmyadmin (or other database management software)
  2. Enter the database of your website wp_users Table.
  3. Find the line of account you need to modify.
  4. double-click user_pass The value of that line, replace the content with 06a5ac9504e3a3c83574cf7a6479be2d
  5. Log in to the website again, and change the password to hao123

 Phpmyadmin database

Find administrator ID and user name

If you do not know your administrator ID and user name after accessing the database, you can wp_usermeta Find in the table
meta_key Value is wp_user_level meta_value The value is 10 user_id The number is the administrator ID.

See how many (multiple administrators) or not (to be deleted administrators).

Forgot the database and FTP account password?

  • If you forget the database password, use ftp to access the root directory of your website, open wp-config.php, and there will be your database information.
  • If you forget your FTP password, you can also access the server through SSH to view this file.
  • If you forget your server password, you can reset it in the server management panel.
  • If you forget the password of the server management interface, you can reset the password on the website where you purchased the server.
  • If you forget the URL and password of the server you purchased, you can consider giving up building a website.
5/5 - (2 votes)
Scroll to top