If you forget your password but remember your mailbox, it would be easy. However, if you forget your email account, it would be a little troublesome. The method is as follows:
1. Log on to the backend of your server and phpmyadmin. The first step after logging on is to select a database. Generally, all virtual hosts have phpmyadmin. Select the database to be modified and find the user table (wp_users is the default WP user table ).
2. Find the password field (user_pass), change the password field value (that is, the MD5 password), and change the password field value (that is, the MD5 password):
5d41402abc4b2a76b9719d911017c592
3. Return to the WordPress login page and log on with the password "hello.
Example
进入网站后台,使用phpmyadmin登录数据库如登录cPanel, 在Databases(数据库)下单击 phpMyAdmin。
选择 WordPress 数据库. 例如: Username_wrdp1.
Find wp_users and click Browse.
Locate Username and click Edit)
Enter a new password to user_pass. Remember, the case is different.
Once this is done, select the drop-down box under the Function and select MD5. At the bottom of the page, click the Go (execute) button. If it still fails, we will use the FTP method to modify it.
Use code to remove login links
If neither of the above methods can change your background login password, you can try the following method. It is also very simple to use. First create a text document, rename it as wpjianzhan. php, then open it with DW, and add the following code to it:
The code is as follows: |
Copy code |
<? Php Require ('WP-blog-header.php '); $ Query_str = "select id from $ wpdb-> users "; $ User_ids = $ wpdb-> get_results ($ query_str ); Foreach ($ user_ids as $ uid ){ $ User_id = $ uid-> ID; If (user_can ($ user_id, 'admin ')){ $ User_info = get_userdata ($ user_id ); $ User_login = $ user_info-> user_login; Wp_set_current_user ($ user_id, $ user_login ); Wp_set_auth_cookie ($ user_id ); Do_action ('WP _ login', $ user_login ); Echo "You are logged in as $ user_login "; If (function_exists ('Get _ admin_url ')){ Wp_redirect (get_admin_url ()); } Else { Wp_redirect (get_bloginfo ('wpurl'). '/wp-admin '); } Exit; } } ?>
|
After adding it, save it, upload it to the root directory of the space, and then access wpjianzhan. php (your domain name/wpjianzhan. php), you can directly log on to the background of your website. After entering the background, you can change the logon password. After changing the password, remember to delete wpjianzhan. php in the directory where the space is located.
Method 3,Create a passwordreset. php file, uploaded to the root directory of the website through FTP or other methods, access http: // your domain name/passwordreset. php, and then reset the password as Prompted. After resetting the password, remember to delete the passwordreset file. php creation method: create a text document, copy the following code, and save it as passwordreset. php, Notepad ++ text editing tool is recommended.
The code is as follows: |
Copy code |
<? Php // Password resetter Include ("wp-config.php "); Include ("wp-blog-header.php "); If (emptyempty ($ _ POST ['emergency _ pass']) { ?> <Form method = "post"> Set admin password: <input name = "emergency_pass" type = "password"/> <Input type = "submit"/> </Form> <? Php } Else { $ SQL = "UPDATE ". $ wpdb-> users. "SET user_pass = '". md5 ($ _ POST ['ergency _ pass']). "'Where User_login = 'admin '"; $ Link = $ wpdb-> query ($ SQL ); Wp_redirect ('WP-login. Php '); Exit (); } ?> |
Admin marked in red needs to be changed to your actual login username
Method 4:
1. First, log on to your FTP, find the directory where the current topic is located, and download "functions. php" under the Directory to your local device. If it does not exist, create a new one locally.
2. Use a text editor (Notepad is not recommended) to open the "functions. php" file, starting with "<? Add a line of code below php:
Wp_set_password ('New password', user id );
When WP is installed, the default user ID is 1. For example, you can change the user password with ID 1 to 123456, as shown below:
The code is as follows: |
Copy code |
<? Php Wp_set_password ('2017 & prime;, 1 ); /** * @ Package WordPress * @ Subpackage Default_Theme */ |
3. Upload The "functions. php" file to overwrite the original file.
4. Open the WordPress homepage (or any other WordPress page), and the password is reset automatically.
5. Delete the added code by referring to the previous steps.
Then we can use the new password to log on.
Method 5:Open/wp-uplodes/pluggable. php. Modify the wp_set_auth_cookie function.
Find rows 691 and 700
The code is as follows: |
Copy code |
Setcookie ($ auth_cookie_name, $ auth_cookie, $ expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $ secure, true ); To: Setcookie ($ auth_cookie_name, $ auth_cookie, $ expire, SITECOOKIEPATH, COOKIE_DOMAIN, $ secure, true ); |
(Note: the upper case cannot be changed to lower case) this method is only applicable to the wordpress website creation system.