Forgetting passwords happens to everyone. Have you ever found yourself unable to log in to your WordPress site because you forgot the admin password? Fortunately, WordPress offers several ways to recover or reset it. Here are some common solutions.
1. Reset via Another Administrator
If your site has other administrators, they can help you reset your password. This is the easiest and most convenient method.
Steps:
- In the WordPress dashboard, go to “Users” > “All Users”.
- Find your username in the list and click “Edit”.
- Scroll down to the “New Password” section and click “Generate Password”.
- You can use the generated password or enter your own. For better WordPress security, always choose a strong password.
- Click “Update Profile”.
2. Recover via Email
If you remember your username or registered email address, you can use the built-in “Lost your password?” feature.
Steps:
- Go to your WordPress login page (e.g., http://yoursite.com/wp-login.php).
- Click the “Lost your password?” link.
- Enter your username or email address.
- Check your email for a reset link.
- Click the link, set a new password, and save it.
3. Reset via MySQL Command Line
If you have SSH access, you can use the MySQL command-line tool to update your password directly in the database.
Steps:
1. Log in to MySQL:
mysql -u root -p
2. Select your WordPress database:
use your_database_name;
3. Update the password (replace the ID and hash as needed). You can generate a WordPress password hash online.
UPDATE wp_users SET user_pass = 'YOUR_NEW_PASSWORD_HASH' WHERE ID = 1;
4. Reset via phpMyAdmin
If you have access to phpMyAdmin, you can modify the password hash in the `wp_users` table.
Steps:
- Open phpMyAdmin and find your WordPress database.
- Browse the `wp_users` table and find your user.
- Edit the `user_pass` field by entering a new MD5 hash or a generated WordPress hash.
- Save the changes and log in.
5. Reset via FTP
You can use the wp_set_password function in your theme’s functions.php file.
Steps:
- Connect via FTP and download your theme’s
functions.phpfile. - Add
wp_set_password('new_password', 1);at the beginning of the file (after<?php). - Upload the file and visit your site once. Your password is now reset.
- Important: Remove the code immediately after logging in.
6. Reset via WP-CLI
WP-CLI is a powerful command-line tool for managing WordPress.
Steps:
wp user update 1 --user_pass="new_password"
Password Management Tips
To improve security, use complex passwords and a password manager (like Chrome’s built-in manager, 1Password, or Enpass) to keep track of them. This helps you maintain strong security without needing to remember every single password.
