If you have been locked out of your WordPress admin dashboard — due to a forgotten password, a deleted account, or a plugin conflict — you can regain access by creating a new administrator user directly in the database via phpMyAdmin.
Step 1: Open phpMyAdmin
- Log in to your cPanel account.
- Navigate to the Databases section and click phpMyAdmin.
Step 2: Select Your WordPress Database
Click your WordPress database in the left sidebar. All WordPress tables will appear. Look for tables prefixed with your database prefix (default: wp_).
Step 3: Insert a New User in the wp_users Table
- Click the
wp_userstable. - Click the Insert tab at the top.
- Fill in the fields as follows:
ID— Pick a unique number not used by existing users.user_login— The username for logging in.user_pass— Enter your desired password. Important: In the Function column for this field, selectMD5from the dropdown. WordPress will automatically upgrade the hash to its native phpass format when you first log in.user_nicename— The user's full name or nickname.user_email— A valid email address.user_url— Your website URL (e.g.,https://yoursite.com).user_registered— Use the date/time picker or leave the default.user_activation_key— Leave blank.user_status— Set to0.display_name— The name displayed on the site.
Click Go to save the new user record. Note the ID value you used — you will need it in the next step.
Step 4: Assign Administrator Capabilities in wp_usermeta
- Click the
wp_usermetatable. - Click the Insert tab.
- Fill in the fields:
umeta_id— Leave blank (auto-generated).user_id— Enter theIDfrom Step 3.meta_key— Enterwp_capabilities(or your custom prefix +capabilities).meta_value— Enter the following serialized value:a:1:{s:13:"administrator";s:1:"1";}
Click Go to insert the row.
Step 5: Set the User Level (Required by Some Plugins)
- Still in
wp_usermeta, click Insert again. - Fill in:
user_id— Same user ID from Step 3.meta_key—wp_user_levelmeta_value—10
Click Go.
Step 6: Log In to WordPress
Navigate to https://yoursite.com/wp-login.php and log in with the new username and password. Once logged in, you can manage other users, reset passwords, or investigate what caused the lockout.
Important Notes
- Always back up your database before making manual changes. In cPanel, go to Databases → Backups or use phpMyAdmin → Export.
- Some installations use a custom database table prefix (e.g.,
abc_instead ofwp_). Adjustwp_users,wp_usermeta,wp_capabilities, andwp_user_levelaccordingly. Check thetable_prefixvalue in yourwp-config.phpfile if unsure. - WordPress automatically converts the MD5 password hash to a secure phpass hash on first successful login.
- Delete the temporary admin account once you have regained access to your original account.
Troubleshooting
- "Access denied" or blank page after login: Clear your browser cache and cookies, then try again.
- Cannot find
wp_userstable: Your database uses a custom prefix. Checkwp-config.phpfor the$table_prefixvalue. - User appears but has no admin privileges: Verify the
wp_capabilitiesmeta_key was inserted with the correct user_id and serialized value. A common mistake is a typo in the serialized string. - Still locked out: The issue may be caused by a security plugin (e.g., Wordfence, iThemes Security). Try temporarily renaming the plugin's folder via cPanel → File Manager to disable it.