If you lose your WordPress account, can't reset it, or need to create an administrative user without access to the WordPress Dashboard, you can create a new WordPress admin user directly from the database.
Add WordPress Admin
1. Open your cPanel account
2. Underneath "Databases", click "phpMyAdmin"
3. Select your WordPress database
4. Select the wp_users table
- If you have a custom database prefix, this will instead be yourprefix_users. Be sure to take this into account in later steps as well
5. Click Insert at the top
6. Fill out the required new user data.
- ID - Enter any available ID number. You'll need to know this ID number later!
- user_login - The username for this user.
- user_pass- The raw password the user will log in with.
- NOTE: The function dropdown on the left MUST be set to MD5 or the password will NOT work.
- user_nicename - The author slug or name (Example: your-name).
- user_email - The email address associated with this user.
- user_registered - Any real date/time.
- user_status - Set this to 0.
- display_name - The display name for the user (Example: Your Name).
7. Click Go at the bottom
8. Click Go again on the query page
- You should get a green check mark and success banner.
- If you get a red error at the bottom, the user has not been inserted. Follow the error message to correct the issue until you are successful.
9. On the left hand menu click wp_usermeta
10. Click Insert at the top
11. Fill out the following required fields for user capabilities:
- user_id - Same ID from Step 6
- meta_key - wp_capabilities
- If you have a prefix for your WordPress installation, you will need to use the same prefix key here. (Example: Your database prefix is "wp123", your key name is "wp123_capabilities")
- meta_value - a:1:{s:13:"administrator";b:1;}
12. Click Go at the bottom
13. Click Go again on the query
- You should get a green check mark and success banner.
- If you get a red error at the bottom, the user has not been inserted. Follow the error message to correct the issue until you get a success.
14. Click Insert at the top again
- user_id - Same ID from Step 6
- meta_key - wp_user_level
- If you have a prefix for your WordPress installation, you will need to use the same prefix key here. (Example: Your database prefix is "wp123", your key name is "wp123_user_level")
- meta_value - 10
15. Click Go at the bottom
You should now be able to access the site with your new admin user. If you have any issues, recheck that each step is done exactly as described.
If you have a custom database prefix, ensure you've done each step in the respective custom prefix table name.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article