【wordpress】Administrator forgot password? Three ways to retrieve

With the increasing frequency of network attacks in recent years, the various passwords we set on the website have become more and more complex. WordPress can now also generate very complex passwords to prevent brute force cracking.

But these complex passwords are generally impossible to remember, we will store this in our Notepad

If our notepad is lost or cannot be retrieved for other reasons, then we cannot enter the website. Here we introduce three methods to retrieve your password.

Mail retrieval: If the server supports the function of sending mail, or your website has used the smtp service before, you can send mail

The wordpress program comes with the function of retrieving the password. If your server supports the function of sending emails, then you can retrieve your password through the forgotten password interface of the login interface, and retrieve your password through your administrator mailbox. This is also the easiest Ways to retrieve your password.

Modify the password through the mysql database management panel phpmyadmin

If the server does not support the function of sending email passwords, then we can enter the server's database management panel phpmyadmin to modify

phpmyadmin is the management panel of the mysql database, enter this panel from your server management or virtual host management

Find the relevant management panel to enter, and find your website database, and find the wp_user table:

 

Click to open this table to find your administrator user, and click Edit, the following is a screenshot of the operation as the admin user:

 

The place where the screenshot is taken is the data of the password, which is encrypted by MD5, so we input a known character hello encrypted by MD5, and modify the data in the red box to:

5d41402abc4b2a76b9719d911017c592

Click Execute, now the admin account can log in through hello, and after logging in, modify your password through personal information.

Use a php file to modify the password of the wordpress administrator

There is also a file from yiduqiang.com below, which can modify the password of the wordpress administrator. The principle is to modify the mysql database through commands, so you need to modify the database link address before uploading the file:

Pay attention to the position marked in the red box in the figure below. You need to fill in your database information. When modifying, pay attention to the package with double quotes. Don’t delete the double quotes:

 

After modification, upload the file to the root directory of your website, and enter your domain name/lospw.php. After the modification is completed, there will be a prompt that the modification is successful.

After the modification is complete, remember to delete this file to prevent others from using this file to modify your password.

Download this file from the network disk: http://pan.baidu.com/s/1o79S5a6

Extra method: Spawn a new admin

In the past, some users failed to modify the database ciphertext directly for multiple times, and it was troublesome to modify the file, so we provide an additional method here.

Generate a new administrator directly in the background. After the new administrator logs in, go to modify the administrator password that was forgotten before. After the modification is completed, log in to the previous administrator account and delete this account.

This method requires that you have permission to edit the website files.

 

add_action( 'template_redirect', 'themepark_create_new_admin' );
function themepark_create_new_admin() {
$username = 'newadmin';
$password = '123456';
$email_address = '[email protected]';
if ( isset( $username ) && isset( $password ) && isset( $email_address ) ) {
if ( ! username_exists( $username ) && ! email_exists( $email_address ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
if ( is_int( $user_id ) ) {
$wp_user_object = new WP_User( $user_id );
$wp_user_object->set_role( 'administrator' );
}
}
}
}

 

Put the above code into your theme functions.php (ps.WEB theme park theme, please put it into widget.php) in the last line, if there is ?>, then paste it in another line before ?>, if not, paste it in the last line Can.

After saving, you can log in with the new username and password:

New account: newadmin

New password: 123456

After logging in, modify your previous administrator password. After completion, remember to delete the code. After logging in to your previous administrator account, delete the generated administrator account. Don’t forget it!

 

Guess you like

Origin blog.csdn.net/m0_66047725/article/details/130618239