Documentation-Issue-Tracker
Documentation-Issue-Tracker copied to clipboard
[HelpHub] Feedback on Reset your password
URL of the Page with the Issue
https://wordpress.org/documentation/article/reset-your-password/
Report content (issue description)
The “Through the MySQL Command Line” section (https://wordpress.org/documentation/article/reset-your-password/#through-mysql-command-line) produces errors on most of the commands because the double quotes (“) and single quotes (‘) have been changed to their typographic equivalents, e.g. left double quotes (“), right double quotes (”), etc.
By https://profiles.wordpress.org/cuibonobo/
This isn’t helpful. WordPress hasn’t used MD5 for a very long time. I am surprised this hasn’t been updated.
By https://profiles.wordpress.org/beqqie/
Section of Page with the issue
Why is this a problem?
Suggested Fix
Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels.
/assign
Hey @karthick-murugan, thanks for your interest in this issue! 🍪🍪🍪
If you have any questions, do not hesitate to ask them in our #docs Slack channel.
Enjoy and happy contributing ❤️
Remove the contents below this Heading "Through MySQL Command" and replace it with the following latest method.
Use the following secure method to reset a WordPress user password directly in the database.
Step 1: Log in to MySQL
Open your terminal and enter:
mysql -u root -p
Enter your MySQL root password when prompted.
Step 2: Select Your WordPress Database
Find the name of your WordPress database, then use:
USE your_database_name;
Step 3: Identify the Users Table
Find the correct table name (since some installations may have a different prefix):
SHOW TABLES;
Look for a table ending with _users, like wp_users.
Step 4: Find the User ID
Run this query to check the existing users:
SELECT ID, user_login FROM wp_users;
Find the ID of the user whose password you want to reset.
Step 5: Update the Password Using WordPress Hashing
Instead of MD5, use WordPress's secure hashing function (wp_hash_password). However, MySQL alone cannot generate these hashes. Instead, generate a hashed password using PHP:
Run the following PHP command in your terminal:
php -r "echo password_hash('new-secure-password', PASSWORD_BCRYPT) . PHP_EOL;"
Copy the generated hash and use it in the next MySQL command.
Step 6: Update the Password in MySQL
Replace your_hashed_password with the output from the PHP command:
UPDATE wp_users SET user_pass = 'your_hashed_password' WHERE ID = 1;
(Replace 1 with the correct user ID.)
Step 7: Verify the Change
Check if the password has been updated:
SELECT ID, user_login, user_pass FROM wp_users WHERE ID = 1;
Step 8: Exit MySQL
EXIT;
Alternative: Use WP-CLI (Recommended)
Instead of using MySQL directly, you can reset the password securely using WP-CLI:
wp user update yourusername --user_pass="new-secure-password"
This method is easier, safer, and recommended.
Heads up @docs-reviewers - the "[Status] Review" label was applied to this issue.