1. Modify the wp administrator user name through phpmyadmin:
This method is intuitive and simple, and is suitable for beginners. We use the mysql management tool phpmyadmin provided by the php virtual host to modify the settings.
1. Log on to the control panel of the carefree host, find phpmyadmin, and click enter database account password to log on
Open the WordPress database, select "wp_users" in the database table, and click browse to view your wp administrator account. Generally, the ID is 1.
2. Find the field names user_login and user_nicename, and change the admin name to the user name you want to change. After the command is executed, you can.
II. Quick use of SQL commands
We recommend that you do not use this method for new users, because it is not so intuitive and may be modified by yourself. Open your WordPress database, click SQL following the structure, and enter the following command: (do not forget to execute it)
The code is as follows: |
Copy code |
"Update user set password = password (" new password ") where user = 'username ';" |
3. Use the following php code to directly change the wordpress administrator password
Php complete code is as follows, create a new reset_password.php file, copy the following php code, paste to rest_password.php, convert the format to UTF-8 without bom encoding, save, and then upload to the same directory as the wp-config.php. Enter/reset_password.php in the browser (replace wentong.org with your domain name) and enter the new password.
After the password is reset, you must immediately delete the reset_password.php file. Otherwise, the consequences will be borne by you.
The code is as follows: |
Copy code |
<? Php /** * Tool for modifying the WordPress website password. * Filename: reset_password.php * @ By meimi Studio */ Include ("wp-config.php "); Include ("wp-blog-header.php "); If (empty ($ _ POST ['emergency _ pass']) { ?> <Form method = "post"> Enter the expected administrator password: <input name = "emergency_pass" type = "password"/> <Input type = "submit"/> <Br/> after the password is submitted, it is automatically transferred to the WordPress website logon page. <Br/> <font size = "" color = "red"> Note: After submission, delete the password reset file to ensure website security. </Font> <Br/> All rights reserved & copy; even meters Studio </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 (); } ?> |