Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HelpHub] Feedback on Reset your password #1707

Open
zzap opened this issue Oct 4, 2024 · 4 comments
Open

[HelpHub] Feedback on Reset your password #1707

zzap opened this issue Oct 4, 2024 · 4 comments
Assignees
Labels
HelpHub feedback Issues reported via feedback form at HelpHub self-assigned [Status] To do Issue marked as Todo user documentation (HelpHub) Improvements or additions to end-user documentation

Comments

@zzap
Copy link
Member

zzap commented Oct 4, 2024

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

@zzap zzap added [Status] To do Issue marked as Todo HelpHub feedback Issues reported via feedback form at HelpHub user documentation (HelpHub) Improvements or additions to end-user documentation labels Oct 4, 2024
Copy link

github-actions bot commented Oct 4, 2024

Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels.

@karthick-murugan
Copy link

/assign

Copy link

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 ❤️

@karthick-murugan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HelpHub feedback Issues reported via feedback form at HelpHub self-assigned [Status] To do Issue marked as Todo user documentation (HelpHub) Improvements or additions to end-user documentation
Projects
Status: No status
Development

No branches or pull requests

2 participants