How to Reset Your WordPress Admin Password
Overview
If you've lost access to your WordPress admin dashboard due to a forgotten password, there are several methods to regain access. This guide covers reliable methods for resetting your WordPress administrator password without using the standard "lost password" email link.
Before You Begin
Accessing Your Hosting Control Panel
To perform these password reset methods, you'll need access to your hosting account:
- Client Portal: Log in to your hosting account at https://ifastnet.com/portal/clientarea.php
- cPanel Access: Once logged in, you can access cPanel directly from the client portal, or visit https://yourdomain.com/cpanel (replace "yourdomain.com" with your actual domain)
Getting Support
If you need assistance with any of these steps:
- Visit our support portal: https://support.ifastnet.com/login.php
- First-time users: You'll need to register for an account before creating your first support ticket
Method 1: Reset Password Using PHPMyAdmin (Recommended)
This method involves directly editing your WordPress database through PHPMyAdmin.
Step 1: Access PHPMyAdmin
- Log in to your cPanel
- Locate and click on PHPMyAdmin in the Databases section
- Select your WordPress database from the left sidebar
Step 2: Locate the Users Table
- Look for a table named
wp_users (the prefix may vary, such as blog_users or site_users)
- Click on the table name to open it
Step 3: Find Your Admin User
- Click the Browse tab to view all users
- Locate your administrator account (usually ID 1 or the username you remember)
- Click the Edit button (pencil icon) next to your user record
Step 4: Update the Password
- Find the
user_pass field in the edit form
- Clear the existing encrypted password
- Enter your new password in plain text (e.g., "mynewpassword123")
- In the dropdown menu next to the password field, select MD5 from the Function column
Step 5: Save Changes
- Click Go to apply the changes
- WordPress will automatically encrypt your password when you log in
Step 6: Log In
- Go to your WordPress admin panel:
https://yourdomain.com/wp-admin
- Log in with your username and the new password you set
- Important: Consider changing your password to something more secure through the WordPress admin interface
Method 2: Add New Admin User via functions.php
This method creates a new administrator account by temporarily adding code to your theme's functions file.
Step 1: Access File Manager
- In cPanel, open File Manager
- Navigate to your WordPress installation directory (usually
public_html)
- Go to
wp-content/themes/[your-active-theme]/
- Locate and edit the
functions.php file
Step 2: Add Admin User Code
Add the following code at the end of the functions.php file (before the closing ?> tag if it exists):
function add_emergency_admin(){
$username = 'emergency_admin';
$password = 'temp_password_123';
$email = '[email protected]';
if (username_exists($username) == null && email_exists($email) == false) {
$user_id = wp_create_user($username, $password, $email);
$user = new WP_User($user_id);
$user->set_role('administrator');
echo 'Emergency admin user created successfully!';
}
}
add_action('wp_loaded', 'add_emergency_admin');
Step 3: Customize the Details
Before saving, modify these values:
$username: Choose a temporary admin username
$password: Set a temporary password
$email: Use a valid email address (must be different from existing users)
Step 4: Execute the Code
- Save the
functions.php file
- Visit your website's homepage:
https://yourdomain.com
- If successful, you should see "Emergency admin user created successfully!" message
Step 5: Clean Up
- Immediately remove the code you added from
functions.php
- Save the file again
- Log in to WordPress admin with the new credentials
- Change the password to something secure
- Consider deleting this temporary user account after regaining access to your original account
Method 3: Reset via wp-config.php
This method temporarily allows anyone to reset passwords by adding a special function.
Step 1: Edit wp-config.php
- In File Manager, locate
wp-config.php in your WordPress root directory
- Edit the file and add this code before the line that says
/* That's all, stop editing! */:
function reset_user_password($user_login, $new_password) {
$user = get_user_by('login', $user_login);
if ($user) {
wp_set_password($new_password, $user->ID);
wp_cache_delete($user->ID, 'users');
wp_cache_delete($user_login, 'userlogins');
return true;
}
return false;
}
// Temporary password reset - REMOVE AFTER USE
if (isset($_GET['reset_wp_pass']) && $_GET['reset_wp_pass'] == 'emergency_reset_2024') {
if (isset($_GET['username']) && isset($_GET['newpass'])) {
if (reset_user_password($_GET['username'], $_GET['newpass'])) {
die('Password reset successful for user: ' . $_GET['username']);
} else {
die('User not found');
}
}
die('Usage: ?reset_wp_pass=emergency_reset_2024&username=YOURUSERNAME&newpass=YOURNEWPASSWORD');
}
Step 2: Use the Reset Function
- Save the
wp-config.php file
- Visit this URL in your browser (replace with your details):
https://yourdomain.com/?reset_wp_pass=emergency_reset_2024&username=YOUR_USERNAME&newpass=YOUR_NEW_PASSWORD
- If successful, you'll see a success message
Step 3: Clean Up Immediately
- Remove the code you added from
wp-config.php immediately after use
- This method is a security risk if left in place
- Log in to WordPress and change your password again
Method 4: Create New User via MySQL Command Line
If you have SSH access or prefer command line:
Step 1: Access MySQL
- In cPanel, open Terminal (if available) or use SSH
- Connect to MySQL:
mysql -u your_username -p your_database_name
Step 2: Insert New Admin User
INSERT INTO wp_users (user_login, user_pass, user_nicename, user_email, user_status, display_name)
VALUES ('newadmin', MD5('newpassword'), 'newadmin', '[email protected]', 0, 'New Admin');
INSERT INTO wp_usermeta (user_id, meta_key, meta_value)
VALUES (LAST_INSERT_ID(), 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');
INSERT INTO wp_usermeta (user_id, meta_key, meta_value)
VALUES (LAST_INSERT_ID(), 'wp_user_level', '10');
Replace table prefix wp_ with your actual prefix if different.
Security Best Practices
After regaining access to your WordPress admin:
- Change your password immediately using WordPress admin dashboard
- Update WordPress to the latest version
- Check user accounts and remove any unauthorized users
- Install security plugins like Wordfence or Sucuri
- Enable two-factor authentication
- Review recent posts and pages for unauthorized changes
- Check installed plugins and themes for suspicious additions
Troubleshooting
Common Issues:
- Table not found: Verify your database name and table prefix in
wp-config.php
- Permission denied: Ensure your hosting account has database modification permissions
- White screen after editing files: Check for syntax errors in your code
- Still can't log in: Clear browser cache and try incognito/private mode
Database Table Prefixes
Your WordPress tables might use a different prefix than wp_. Check your wp-config.php file for this line:
$table_prefix = 'wp_';
The value in quotes is your table prefix.
Still Need Help?
If these methods don't work or you encounter errors:
- Create a support ticket at https://support.ifastnet.com/login.php
- Include details about which method you tried and any error messages
- Our support team can assist with advanced troubleshooting
Important Security Notes
- Always backup your database before making changes
- Remove temporary code immediately after use
- Never leave emergency access methods in place permanently
- Use strong passwords with mixed characters, numbers, and symbols
- Keep WordPress and plugins updated to prevent future lockouts
- Consider using a password manager to avoid future password loss
Prevention Tips
To avoid losing admin access in the future:
- Use a reliable password manager
- Set up WordPress email notifications
- Keep a backup admin account with a different email
- Document your login credentials securely
- Regular database backups
- Enable WordPress automatic updates
Remember: These methods provide powerful access to your WordPress site. Always clean up temporary code and secure your site after regaining access.